Skip to content

Customizing error reports

Honeybadger has several ways to customize the data reported with each error to add custom metadata and request information.

Honeybadger can display additional custom key/value metadata — or “context” — with each error report. Context data can be anything, but a few keys have a special meaning in Honeybadger.

Use $honeybadger->context(); to add global context to error reports:

$honeybadger->context('user_id', 123);
// Add multiple context items:
$honeybadger->context([
'user_id' => 123,
'user_email' => 'homer@simpsons.com',
]);

While you can add any key/value data to context, a few keys have special meaning in Honeybadger:

OptionDescription
user_idThe String user ID used by Honeybadger to aggregate user data across occurrences on the error page.
user_emailSame as user_id, but for email addresses

Honeybadger automatically includes request information for error reports in Laravel/Lumen. In other frameworks which rely on Symphony’s HttpFoundation component, you can include request information when reporting exceptions:

$honeybadger->notify($error, $request);