Reducing Noise
Sometimes there are errors that you would rather not send to Honeybadger because they are not actionable or are handled internally.
In Honeybadger, you can ignore exceptions by
type using the built-in excluded_exceptions
configuration option, as well as the $dontReport
option in
Laravel. You can also disable error reporting in all or some environments.
Ignoring Exceptions By Type
There may be some types of exceptions which you never want to report. To ignore
them, use the excluded_exceptions
configuration
option:
[
'excluded_exceptions' => [
SomeException::class,
AnotherException::class,
],
]
Laravel
If you're using Laravel, Honeybadger respects the
$dontReport
property of Laravel's exception
handler when
automatically reporting exceptions during web requests. This means that any
exceptions which are ignored by Laravel will also be ignored by Honeybadger. You
may add other exception types to this array as needed:
// app/Exceptions/Handler.php
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Validation\ValidationException::class,
];
Keep in mind that Honeybadger will still report exceptions on this list if they are reported outside of Laravel's exception handler, such as when reporting handled exceptions.
Disabling Error Reporting
You can disable error reporting completely by setting the report_data
config option to false. For example, the default Laravel config has this as:
'report_data' => ! in_array(env('APP_ENV'), ['local', 'testing']),
This means exceptions won't be reported to Honeybadger in local
and testing
environments. If you want to change that, you can easily add or remove environments or set report_data
to true
.