1
0
mirror of https://github.com/exane/not-gwent-online synced 2025-01-29 14:28:30 +00:00

52 lines
1.1 KiB
PHP
Raw Normal View History

2015-06-19 18:50:05 +02:00
<?php
2015-06-21 13:09:29 +02:00
namespace Gwent\Exceptions;
2015-06-19 18:50:05 +02:00
2015-06-21 13:09:29 +02:00
use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
2015-06-21 17:14:53 +02:00
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2015-06-21 13:09:29 +02:00
class Handler extends ExceptionHandler {
2015-06-19 18:50:05 +02:00
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
2015-06-21 13:09:29 +02:00
HttpException::class,
2015-06-19 18:50:05 +02:00
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
2015-06-21 13:09:29 +02:00
* @param \Exception $e
*
2015-06-19 18:50:05 +02:00
* @return void
*/
public function report(Exception $e)
{
2015-06-21 13:09:29 +02:00
return parent::report($e);
2015-06-19 18:50:05 +02:00
}
/**
* Render an exception into an HTTP response.
*
2015-06-21 13:09:29 +02:00
* @param \Illuminate\Http\Request $request
* @param \Exception $e
*
2015-06-19 18:50:05 +02:00
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
2015-06-21 13:09:29 +02:00
if($e instanceof NotFoundHttpException) {
2015-06-21 16:34:27 +02:00
return redirect('/');
2015-06-21 13:09:29 +02:00
}
return parent::render($request, $e);
2015-06-19 18:50:05 +02:00
}
2015-06-21 13:09:29 +02:00
}