Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Allow 500 custom error pages when not in debug mode #18481

Merged
merged 2 commits into from
Mar 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,15 @@ protected function convertValidationExceptionToResponse(ValidationException $e,
*/
protected function prepareResponse($request, Exception $e)
{
if ($this->isHttpException($e)) {
return $this->toIlluminateResponse($this->renderHttpException($e), $e);
} else {
if (! $this->isHttpException($e) && config('app.debug')) {
return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
}

if (! $this->isHttpException($e)) {
$e = new HttpException(500, $e->getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want this in 5.4

Anyone who uses PHPStorm and auto-import suggest importing HttpException (which might not exist)

import use Symfony\Component\HttpKernel\Exception\HttpException; instead

}

return $this->toIlluminateResponse($this->renderHttpException($e), $e);
}

/**
Expand Down