WIP
This commit is contained in:
1 parent
78ef14b99b
commit
a8599d9c79
1 file changed
+22
@@ -4,6 +4,8 @@
|
||||
|
||||
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 @@ public function register(): void
|
||||
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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user