diff --git a/error/403.html b/error/403.html new file mode 100644 index 000000000..1ed30a168 --- /dev/null +++ b/error/403.html @@ -0,0 +1,13 @@ + + +
+ +You do not have permissions to access this page.
+ + + \ No newline at end of file diff --git a/src/Core/Exception/PermissionDeniedException.php b/src/Core/Exception/PermissionDeniedException.php index f45c4cfbd..b19268566 100644 --- a/src/Core/Exception/PermissionDeniedException.php +++ b/src/Core/Exception/PermissionDeniedException.php @@ -14,4 +14,8 @@ use Exception; class PermissionDeniedException extends Exception { + public function __construct($message = null, $code = 403, Exception $previous = null) + { + parent::__construct($message, $code, $previous); + } } diff --git a/src/Http/Middleware/HandleErrors.php b/src/Http/Middleware/HandleErrors.php index e43eb71fd..3e85b189f 100644 --- a/src/Http/Middleware/HandleErrors.php +++ b/src/Http/Middleware/HandleErrors.php @@ -52,7 +52,7 @@ class HandleErrors implements ErrorMiddlewareInterface $status = $errorCode; } - if ($this->debug && $errorCode !== 404) { + if ($this->debug && ! in_array($errorCode, [403, 404])) { $whoops = new WhoopsMiddleware; return $whoops($error, $request, $response, $out);