bugsnagmartini

package
v2.4.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 4 Imported by: 16

Documentation

Overview

Package bugsnagmartini provides a martini middleware that sends panics to Bugsnag. You should use this middleware in combination with martini.Recover() if you want to send error messages to your clients:

func main() {
	m := martini.New()
	// used to stop panics bubbling and return a 500 error.
	m.Use(martini.Recovery())

	// used to send panics to Bugsnag.
	m.Use(bugsnagmartini.AutoNotify(bugsnag.Configuration{
		APIKey: "YOUR_API_KEY_HERE",
	})

	// ...
}

This middleware also makes bugsnag available to martini handlers via the context.

func myHandler(w http.ResponseWriter, r *http.Request, bugsnag *bugsnag.Notifier) {
	// ...
	bugsnag.Notify(err)
	// ...
}

Index

Constants

View Source
const FrameworkName string = "Martini"

FrameworkName is the name of the framework this middleware applies to

Variables

This section is empty.

Functions

func AutoNotify

func AutoNotify(rawData ...interface{}) martini.Handler

AutoNotify sends any panics to bugsnag, and then re-raises them. You should use this after another middleware that returns an error page to the client, for example martini.Recover(). The arguments can be any RawData to pass to Bugsnag, most usually you'll pass a bugsnag.Configuration object.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL