2015-02-05 21:52:16 -06:00
|
|
|
<?php namespace FireflyIII\Exceptions;
|
2015-02-05 21:39:52 -06:00
|
|
|
|
|
|
|
use Exception;
|
|
|
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
2015-05-26 15:12:34 -05:00
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2015-02-11 00:35:10 -06:00
|
|
|
/**
|
|
|
|
* Class Handler
|
|
|
|
*
|
2015-05-10 01:08:07 -05:00
|
|
|
* @codeCoverageIgnore
|
2015-02-11 00:35:10 -06:00
|
|
|
* @package FireflyIII\Exceptions
|
|
|
|
*/
|
|
|
|
class Handler extends ExceptionHandler
|
|
|
|
{
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2015-02-11 00:35:10 -06:00
|
|
|
/**
|
|
|
|
* A list of the exception types that should not be reported.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dontReport
|
|
|
|
= [
|
|
|
|
'Symfony\Component\HttpKernel\Exception\HttpException'
|
|
|
|
];
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2015-02-11 00:35:10 -06:00
|
|
|
/**
|
|
|
|
* Render an exception into an HTTP response.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Exception $e
|
2015-05-17 03:10:58 -05:00
|
|
|
* @SuppressWarnings(PHPMD.ShortVariable)
|
2015-02-11 00:35:10 -06:00
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function render($request, Exception $e)
|
|
|
|
{
|
2015-05-26 15:12:34 -05:00
|
|
|
if ($e instanceof HttpException) {
|
2015-02-11 00:35:10 -06:00
|
|
|
return $this->renderHttpException($e);
|
|
|
|
} else {
|
|
|
|
return parent::render($request, $e);
|
|
|
|
}
|
|
|
|
}
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2015-02-11 00:35:10 -06:00
|
|
|
/**
|
|
|
|
* Report or log an exception.
|
|
|
|
*
|
|
|
|
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
2015-05-17 03:30:18 -05:00
|
|
|
* @SuppressWarnings(PHPMD.ShortVariable)
|
2015-02-11 00:35:10 -06:00
|
|
|
*
|
|
|
|
* @param \Exception $e
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function report(Exception $e)
|
|
|
|
{
|
2015-05-05 03:23:01 -05:00
|
|
|
parent::report($e);
|
2015-02-11 00:35:10 -06:00
|
|
|
}
|
2015-02-05 21:39:52 -06:00
|
|
|
|
|
|
|
}
|