Customizing Error Reports

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

Custom Metadata (Context)

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:

php
$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:

Option Description
user_id The String user ID used by Honeybadger to aggregate user data across occurrences on the error page.
user_email Same as user_id, but for email addresses

Sending Request Information

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:

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