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.

The notify and notifyError functions accept a block to modify the error report using a representation of the report which will be sent. Below are the available options for modifying the report.

The report object

context

Set the context of the error report. This is normally the location of the error and should be populated automatically. Context is displayed in the dashboard prominently.

Bugsnag.notify(exception, block: { report in
    report.context = "XYZMenuController"
})

errorClass

The type of the error which generated the report. This should be populated automatically with the class name of the error.

Bugsnag.notify(exception, block: { report in
    report.errorClass = "Authentication failed"
})

errorMessage

The message or description of the error which generated the report.

Bugsnag.notify(exception, block: { report in
    report.errorMessage = "Username rejected by the auth server"
})

groupingHash

Sets the grouping hash of the error report. All errors with the same grouping hash are grouped together. This is an advanced usage of the library and mis-using it will cause your errors not to group properly in your dashboard.

Bugsnag.notify(exception, block: { report in
    report.groupingHash = "unexpected-auth-failures"
})

metaData

To attach additional diagnostic data to a report, use the metaData property, which is mapped to metadata tabs on a report in the Bugsnag dashboard. Each top-level key adds an additional tab:

Bugsnag.notify(exception, block: { report in
    report.metaData["food"] = [
        "breakfast": "toast and eggs",
        "lunch":     "hamburger"
    ]
})

releaseStage

The stage of development of the application currently running.

Bugsnag.notify(exception, block: { report in
    report.releaseStage = "beta-group-23"
})

severity

A rating of how critical an error report is.

Bugsnag.notify(exception, block: { report in
    report.severity = .Error;
})