refactor: improve exception handler for sentry (#5806)

This commit is contained in:
Alexis Saettler
2021-12-27 20:58:27 +01:00
committed by GitHub
parent cb6446ed74
commit 8ce3550cd8
+9 -9
View File
@@ -31,20 +31,20 @@ class Handler extends ExceptionHandler
];
/**
* Report or log an exception.
* Register the exception handling callbacks for the application.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $e
* @return void
* @codeCoverageIgnore
*/
public function report(Throwable $e)
public function register()
{
if (config('monica.sentry_support') && config('app.env') == 'production' && app()->bound('sentry') && $this->shouldReport($e)) {
app('sentry')->captureException($e); // @codeCoverageIgnore
if (config('monica.sentry_support') && config('app.env') == 'production') {
$this->reportable(function (Throwable $e) {
if ($this->shouldReport($e) && app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
parent::report($e);
}
/**