...

Package sentryhandler

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

Overview ▾

type Handler

Handler is responsible for sending errors to Sentry.

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

func New

func New(dsn string) (*Handler, error)

New creates a new handler.

Example

Code:

dsn := "https://user:password@sentry.io/1234"

handler, err := sentryhandler.New(dsn)
if err != nil {
    panic(err)
}
defer handler.Close() // Make sure to close the handler to flush all error reporting in progress

func NewFromClient

func NewFromClient(client *raven.Client) *Handler

NewFromClient creates a new handler from a client instance.

Example

Code:

dsn := "https://user:password@sentry.io/1234"

client, err := raven.New(dsn)
if err != nil {
    panic(err)
}

handler := sentryhandler.NewFromClient(client)
defer handler.Close() // Make sure to close the handler to flush all error reporting in progress

func NewSync

func NewSync(dsn string) (*Handler, error)

NewSync creates a new handler that sends errors synchronously.

Example

Code:

dsn := "https://user:password@sentry.io/1234"

handler, err := sentryhandler.NewSync(dsn)
if err != nil {
    panic(err)
}
defer handler.Close()

func NewSyncFromClient

func NewSyncFromClient(client *raven.Client) *Handler

NewSyncFromClient creates a new handler from a client instance that sends errors synchronously.

Example

Code:

dsn := "https://user:password@sentry.io/1234"

client, err := raven.New(dsn)
if err != nil {
    panic(err)
}

handler := sentryhandler.NewSyncFromClient(client)
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 Rollbar.