public function __construct($message = null, $variables = [])
 {
     if ($message === null) {
         $message = "Bad request to :page";
         $variables = [':page' => Mii::$app->request->uri()];
     }
     parent::__construct(400, $message, $variables);
 }
Example #2
0
 protected function exception_to_array($e)
 {
     if (!config('debug') && !$e instanceof HttpException) {
         $e = new HttpException(500, 'There was an error at the server.');
     }
     $array = ['name' => $e instanceof Exception || $e instanceof ErrorException ? $e->get_name() : 'Exception', 'message' => $e->getMessage(), 'code' => $e->getCode()];
     if ($e instanceof HttpException) {
         $array['status'] = $e->statusCode;
     }
     if (config('debug')) {
         $array['type'] = get_class($e);
         $array['file'] = $e->getFile();
         $array['line'] = $e->getLine();
         $array['stack-trace'] = explode("\n", $e->getTraceAsString());
     }
     if (($prev = $e->getPrevious()) !== null) {
         $array['previous'] = $this->exception_to_array($prev);
     }
     return $array;
 }
Example #3
0
 public function __construct()
 {
     parent::__construct(404, "Page not found :page", [':page' => Mii::$app->request->uri()]);
 }