mirror of
https://github.com/cydrobolt/polr.git
synced 2024-09-19 23:21:47 +02:00
Allow Lumen to use custom error handlers
This commit is contained in:
parent
6086e32c1c
commit
82be265af8
@ -4,6 +4,8 @@ namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
@ -39,6 +41,13 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if ($e instanceof NotFoundHttpException){
|
||||
return view('errors.404');
|
||||
}
|
||||
if ($e instanceof HttpException){
|
||||
return view('errors.500');
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
@section('content')
|
||||
<h1>404</h1>
|
||||
<p>This page could not be found.</p>
|
||||
<h4>Are you sure you got the poles right?</h4>
|
||||
<h4>Are you sure you correctly entered the URL?</h4>
|
||||
@endsection
|
||||
|
@ -3,5 +3,5 @@
|
||||
@section('content')
|
||||
<h1>500</h1>
|
||||
<p>Oh dear. Something seems to have gone awry.</p>
|
||||
<h4>Cold as an iceberg.</h4>
|
||||
<h4>Please contact an administrator to report this issue.</h4>
|
||||
@endsection
|
||||
|
Loading…
Reference in New Issue
Block a user