Change exception handling for display exception

This commit is contained in:
Dane Everitt 2018-03-10 13:02:41 -06:00
parent ef371a508d
commit e5c59c4984
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 40 additions and 7 deletions

View file

@ -5,6 +5,7 @@ namespace Pterodactyl\Exceptions;
use Exception;
use PDOException;
use Psr\Log\LoggerInterface;
use Illuminate\Container\Container;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
@ -24,7 +25,6 @@ class Handler extends ExceptionHandler
protected $dontReport = [
AuthenticationException::class,
AuthorizationException::class,
DisplayException::class,
HttpException::class,
ModelNotFoundException::class,
RecordNotFoundException::class,
@ -201,6 +201,17 @@ class Handler extends ExceptionHandler
return ['errors' => [array_merge($error, $override)]];
}
/**
* Return an array of exceptions that should not be reported.
*
* @param \Exception $exception
* @return bool
*/
public static function isReportable(Exception $exception): bool
{
return (new static(Container::getInstance()))->shouldReport($exception);
}
/**
* Convert an authentication exception into an unauthenticated response.
*