ldc-gen-game-web/app/Exceptions/Handler.php

52 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2020-10-21 15:26:21 +02:00
<?php
2026-10-02 12:09:46 +02:00
declare(strict_types=1);
2020-10-21 15:26:21 +02:00
namespace App\Exceptions;
2023-08-21 10:22:07 +02:00
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
2020-10-21 15:26:21 +02:00
class Handler extends ExceptionHandler
{
2023-08-21 10:22:07 +02:00
/**
* A list of exception types with their corresponding custom log levels.
*
2026-10-02 12:09:46 +02:00
* @var array<class-string<Throwable>, \Psr\Log\LogLevel::*>
2023-08-21 10:22:07 +02:00
*/
2026-10-02 12:09:46 +02:00
#[\Override]
2023-08-21 10:22:07 +02:00
protected $levels = [];
2020-10-21 15:26:21 +02:00
/**
* A list of the exception types that are not reported.
*
2026-10-02 12:09:46 +02:00
* @var array<int, class-string<Throwable>>
2020-10-21 15:26:21 +02:00
*/
2026-10-02 12:09:46 +02:00
#[\Override]
2023-08-21 10:22:07 +02:00
protected $dontReport = [];
2020-10-21 15:26:21 +02:00
/**
2023-08-21 10:22:07 +02:00
* A list of the inputs that are never flashed to the session on validation exceptions.
2020-10-21 15:26:21 +02:00
*
2023-08-21 10:22:07 +02:00
* @var array<int, string>
2020-10-21 15:26:21 +02:00
*/
2026-10-02 12:09:46 +02:00
#[\Override]
2020-10-21 15:26:21 +02:00
protected $dontFlash = [
2023-08-21 10:22:07 +02:00
'current_password',
2020-10-21 15:26:21 +02:00
'password',
'password_confirmation',
];
2023-08-21 10:22:07 +02:00
/**
* Register the exception handling callbacks for the application.
*/
2026-10-02 12:09:46 +02:00
public function register(): void
2023-08-21 10:22:07 +02:00
{
2026-10-02 12:09:46 +02:00
$this->reportable(function (Throwable $e): void {
2023-08-21 10:22:07 +02:00
if (app()->bound('sentry')) {
2026-10-02 12:09:46 +02:00
resolve('sentry')->captureException($e);
2023-08-21 10:22:07 +02:00
}
});
}
2020-10-21 15:26:21 +02:00
}