Reporting handled errors

In order to quickly understand and fix errors, it is often helpful to send errors that have been handled by your application to Bugsnag, with additional diagnostic data that is specific to the error.

Basic usage

If you would like to send handled errors to Bugsnag, pass an error class and message to the Notify function.

By default, the error class is used along with the site of the call to Notify to group similar occurrences together on our dashboard. If you’d like occurrences to be grouped together, use a static string for the name or class, and put information that may change in the message.

if (Failed)
    UBugsnagFunctionLibrary::Notify(TEXT("Asset loading failed"),
        FString::Printf(TEXT("Could not find asset %s"), *AssetName));

See Error grouping for more information about about how and why events are grouped into errors.

You can also report handled errors from Blueprints using Bugsnag’s “Notify” action and providing an error class and message: Start Bugsnag from a Blueprint

Customizing diagnostic data

You can send handled errors with diagnostic data or other customizations by passing an FBugsnagOnErrorCallback as an argument to Notify.

The callback receives an Event object as a parameter which can be used to add or amend the data sent to your Bugsnag dashboard. You can also return false from the callback to prevent the event being sent at all:

UBugsnagFunctionLibrary::Notify(TEXT("Validation Error"), TEXT("No name specified"),
    [](TSharedRef<IBugsnagEvent> Event)
        // Add extra information
        Event->AddMetadata(TEXT("account"), TEXT("name"), TEXT("Acme Co."));
        Event->AddMetadata(TEXT("account"), TEXT("paying_customer"), true);

        // Increase severity

        // Return `false` if you'd like to stop this error being reported
        return true;

See Customizing error reports for more information about the properties and methods available in an Event object.