From a8599d9c79bff409b12121c40e2ed03770b59e08 Mon Sep 17 00:00:00 2001 From: Mekan1206 Date: Thu, 19 Feb 2026 18:11:13 +0500 Subject: [PATCH] WIP --- app/Exceptions/Handler.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index cb946e8..f531fe5 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -4,6 +4,8 @@ namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Throwable; +use Symfony\Component\HttpKernel\Exception\HttpException; class Handler extends ExceptionHandler { @@ -29,5 +31,25 @@ class Handler extends ExceptionHandler return response()->noContent(404); } }); + + $this->reportable(function (Throwable $e) { + $statusCode = $e instanceof HttpException ? $e->getStatusCode() : 500; + + // only real server errors + if ($statusCode < 500) { + return; + } + + try { + warn( + message: get_class($e), + content: $e->getMessage(), + where: $e->getFile() . ':' . $e->getLine(), + notes: substr($e->getTraceAsString(), 0, 65000), + ); + } catch (Throwable $ignored) { + // logging must never crash the app + } + }); } }