...

Package airbrakehandler

import "github.com/goph/emperror/handler/airbrakehandler"
Overview
Index
Examples

Overview ▾

Package airbrakehandler provides Airbrake/Errbit integration.

type Handler

Handler is responsible for sending errors to Airbrake/Errbit.

type Handler struct {
    // contains filtered or unexported fields
}

func New

func New(projectID int64, projectKey string) *Handler

New creates a new handler.

Example

Code:

projectID := int64(1)
projectKey := "key"

handler := airbrakehandler.New(projectID, projectKey)
defer handler.Close() // Make sure to close the handler to flush all error reporting in progress

func NewFromNotifier

func NewFromNotifier(notifier *gobrake.Notifier) *Handler

NewFromNotifier creates a new handler from a notifier instance.

Example

Code:

projectID := int64(1)
projectKey := "key"

notifier := gobrake.NewNotifier(projectID, projectKey)
handler := airbrakehandler.NewFromNotifier(notifier)
defer handler.Close() // Make sure to close the handler to flush all error reporting in progress

func NewSync

func NewSync(projectID int64, projectKey string) *Handler

NewSync creates a new handler that sends errors synchronously.

Example

Code:

projectID := int64(1)
projectKey := "key"

handler := airbrakehandler.NewSync(projectID, projectKey)
defer handler.Close()

func NewSyncFromNotifier

func NewSyncFromNotifier(notifier *gobrake.Notifier) *Handler

NewSyncFromNotifier creates a new handler from a notifier instance that sends errors synchronously.

Example

Code:

projectID := int64(1)
projectKey := "key"

notifier := gobrake.NewNotifier(projectID, projectKey)
handler := airbrakehandler.NewSyncFromNotifier(notifier)
defer handler.Close()

func (*Handler) Close

func (h *Handler) Close() error

Close closes the underlying notifier and waits for asynchronous reports to finish.

func (*Handler) Handle

func (h *Handler) Handle(err error)

Handle sends the error to Airbrake/Errbit.