Skip to content

Instantly share code, notes, and snippets.

@sword-jin
Last active September 5, 2015 05:20
Show Gist options
  • Select an option

  • Save sword-jin/cbb644bc43cac0df5efc to your computer and use it in GitHub Desktop.

Select an option

Save sword-jin/cbb644bc43cac0df5efc to your computer and use it in GitHub Desktop.
修改 default page 在handle.php 中重写 convertExceptionToResponse 方法
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer;
class Handler extend ExceptionHandler
{
/**
* Convert the given exception into a Response instance.
*
* @param \Exception $e
*
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function convertExceptionToResponse(Exception $e)
{
$debug = config('app.debug', false);
if ($debug) {
return (new SymfonyDisplayer($debug))->createResponse($e);
}
return response()->view('errors.default', ['expection' => $e], 500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment