#719 Fixed PermissionDeniedException

...causing Whoops on debug and 500 HTTP error
instead of 403 Forbidden error page.
This commit is contained in:
Albert221 2016-01-07 17:55:08 +01:00
parent 4d8259cd95
commit 4cdcd19597
3 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>403 Forbidden</h1>
<p>You do not have permissions to access this page.</p>
</body>
</html>

View File

@ -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);
}
}

View File

@ -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);