Reporting handled exceptions

In order to quickly understand and fix some errors, it is often helpful to send additional diagnostic data which is specific to that error.

Setting the severity

You can set the severity of an error in Bugsnag by including the severity option when notifying Bugsnag of the error:

import com.bugsnag.Severity;

bugsnag.notify(new RuntimeException("Non-fatal"), Severity.ERROR)

Valid severities are ERROR, WARNING and INFO.

Severity is displayed in the dashboard and can be used to filter the error list. By default all crashes (or unhandled exceptions) are set to ERROR and all bugsnag.notify calls default to WARNING.

Setting metadata

You can send additional metadata of an error by including a callback when notifying Bugsnag of the error:

bugsnag.notify(exception, (report) -> {
    report.addToTab("system resources", "memory", "10MB");
});

Or without using the Java 8 lambda syntax:

import com.bugsnag.callbacks.Callback;
import com.bugsnag.Report;

bugsnag.notify(exception, new Callback() {
    @Override
    public void beforeNotify(Report report) {
        report.addToTab("system resources", "memory", "10MB");
    }
});

For all the available options when modifying a report see customizing error reports.