Reputation: 5069
Having installed Laravel and Bugsnag using the relevant documentation, I found that an NotFoundHttpException
error for instance is not reported to Bugsnag (but notifyError
yes). My question is how to set it so that all errors are reported, without using these lines over and over:
Bugsnag::notifyError('ErrorType', 'Something bad happened');
or
try {
// Some potentially crashy code
} catch (Exception $ex) {
Bugsnag::notifyException($ex);
}
I'm thinking of using the Handler
in app/exceptions
like so:
public function report(Exception $e)
{
Bugsnag::notifyException($e);
parent::report($e);
}
But if it's not mentioned in the Laravel/Bugsnag integration docs, is it a good practice? This Laracast video doesn't describe any changes to the exceptions handler and the setup seems to work as intended.
Upvotes: 5
Views: 1459
Reputation: 41470
In
\app\Exceptions\Handler.php
overwrite internalDontReport
property.
Below is a default that comes inherited from \vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php
protected $internalDontReport = [
AuthenticationException::class,
AuthorizationException::class,
HttpException::class,
HttpResponseException::class,
ModelNotFoundException::class,
TokenMismatchException::class,
ValidationException::class,
];
Upvotes: 0
Reputation: 111
In App\Exceptions\Handler, remove all Exception classes from $dontReport. I'm not sure why you'd want to report all errors, but this should do it for you.
Upvotes: 3