1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Update error handler for L5.2

This commit is contained in:
Hillel Coren 2016-04-11 11:33:25 +03:00
parent 02670fabed
commit 245efeee2f

View File

@ -4,7 +4,11 @@ use Redirect;
use Utils;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Exception\HttpResponseException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Validation\ValidationException;
class Handler extends ExceptionHandler {
@ -14,7 +18,10 @@ class Handler extends ExceptionHandler {
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException'
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];
/**
@ -27,6 +34,11 @@ class Handler extends ExceptionHandler {
*/
public function report(Exception $e)
{
// don't show these errors in the logs
if ($e instanceof HttpResponseException) {
return false;
}
if (Utils::isNinja()) {
Utils::logError(Utils::getErrorString($e));
return false;
@ -59,6 +71,9 @@ class Handler extends ExceptionHandler {
}
}
return parent::render($request, $e);
/*
// In production, except for maintenance mode, we'll show a custom error screen
if (Utils::isNinjaProd() && !Utils::isDownForMaintenance()) {
$data = [
@ -70,5 +85,6 @@ class Handler extends ExceptionHandler {
} else {
return parent::render($request, $e);
}
*/
}
}