Reputation: 944
On fresh Laravel 5.6 installation (APP_DEBUG=true
in .env
file) everything works fine except this situation:
when using abort(500, 'test exception');
, it shows "Whoops, looks like something went wrong." page.
when using abort(501, 'test exception');
, it shows exception trace page.
My question is: why I am getting "Whoops, looks like something went wrong." when exception code is 500
and APP_DEBUG=true
in .env
file?
How to show the normal exception info/trace when the error code is 500 without deleting vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php
.
Upvotes: 1
Views: 837
Reputation: 944
As ourmandave suggested, the solution was to override renderHttpException
function in App\Exceptions\Handler.php
as follow:
protected function renderHttpException(HttpException $e)
{
if (config('app.debug') === true) {
//this shows Laravel exception page
return $this->convertExceptionToResponse($e);
}
//continue as normal
return parent::renderHttpException($e);
}
Upvotes: 1