Documentation
¶
Overview ¶
Package bugsnag provides a library for sending data to the bugsnag error reporting service. It differs from the official library by having special support for github.com/facebookgo/stackerr and a more complete data model.
The main benefit of having special support for stackerr is that we can unwrap its stack traces and send them up as individual exceptions to bugsnag. This shows us every point where `stackerr.Wrap(err)` was called, which can help you trace the path of asynchronous errors through your program.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterErrorConverter ¶
func RegisterErrorConverter(c ErrorConverter)
Types ¶
type App ¶
type App struct { Version string `json:"version"` ReleaseStage string `json:"releaseStage"` Commit string `json:"commit"` }
App represents some information about the application that crashed or encountered an error.
Note that the `Commit` field is non-standard - bugsnag does _not_ actively support this field, so don't annoy them if it doesn't do what you want.
type Client ¶
type Client struct { APIKey string URL string NotifierName string NotifierVersion string NotifierURL string ProjectPackages []string // contains filtered or unexported fields }
Client holds information to include in requests to bugsnag.
func (*Client) Notifications ¶
func (*Client) ReportPanic ¶
func (c *Client) ReportPanic()
type Device ¶
Device represents the device that was accessing the application at the time it crashed, or an error occurred.
type ErrorConverter ¶
type Event ¶
type Event struct { PayloadVersion payloadVersion `json:"payloadVersion"` Exceptions []Exception `json:"exceptions,omitempty"` Threads []Thread `json:"threads,omitempty"` Context string `json:"context,omitempty"` GroupingHash string `json:"groupingHash,omitempty"` Severity string `json:"severity,omitempty"` User *User `json:"user,omitempty"` App *App `json:"app,omitempty"` Device *Device `json:"device,omitempty"` MetaData map[string]map[string]interface{} `json:"metaData,omitempty"` }
Event is an event that goes to bugsnag.
Note: the `PayloadVersion` field is a special type that always encodes to `"2"` in JSON, so it doesn't need to be set for the request to work. In fact, whatever you set it to will be ignored. It just needs to exist for bugsnag.
type Exception ¶
type Exception struct { ErrorClass string `json:"errorClass"` Message string `json:"message"` Stacktrace []StackFrame `json:"stacktrace"` }
Exception represents a single exception.
type StackFrame ¶
type StackFrame struct { File string `json:"file"` LineNumber int `json:"lineNumber"` ColumnNumber int `json:"columnNumber"` Method string `json:"method"` InProject bool `json:"inProject"` Code map[string]string `json:"code,omitempty"` }
StackFrame represents a single stack frame, commonly shown as one line in an exception.
type Thread ¶
type Thread struct { ID string `json:"id"` Name string `json:"name"` Stacktrace []StackFrame `json:"stacktrace"` }
Thread represents a (background?) thread. Threads should be in an order that makes sense for your application.