53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Exceptions;
|
|
|
|
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
|
|
|
class Handler extends ExceptionHandler
|
|
{
|
|
/**
|
|
* A list of the exception types that are not reported.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $dontReport = [];
|
|
|
|
/**
|
|
* A list of the inputs that are never flashed for validation exceptions.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $dontFlash = [
|
|
'password',
|
|
'password_confirmation',
|
|
];
|
|
|
|
/**
|
|
* Report or log an exception.
|
|
*
|
|
* @param \Throwable $e
|
|
* @return void
|
|
*
|
|
* @phpcs:ignore Squiz.Commenting.FunctionComment.EmptyThrows
|
|
* @throws \Exception
|
|
*/
|
|
public function report(\Throwable $e)
|
|
{
|
|
if (get_class($e) == RedirectTo::class) {
|
|
abort(redirect($e->url));
|
|
}
|
|
|
|
if ($this->shouldntReport($e)) {
|
|
return;
|
|
}
|
|
parent::report($e);
|
|
}
|
|
|
|
public function register()
|
|
{
|
|
$this->reportable(function (Throwable $e) {
|
|
Integration::captureUnhandledException($e);
|
|
});
|
|
}
|
|
}
|