sentry: emperror.dev/handler/sentry Index | Examples | Files

package sentry

import "emperror.dev/handler/sentry"

Index

Examples

Package Files

handler.go

type Handler Uses

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

Handler is responsible for sending errors to Sentry.

func New Uses

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

New creates a new handler.

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 Uses

func NewFromClient(client *raven.Client) *Handler

NewFromClient creates a new handler from a client instance.

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 Uses

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

NewSync creates a new handler that sends errors synchronously.

Code:

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

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

func NewSyncFromClient Uses

func NewSyncFromClient(client *raven.Client) *Handler

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

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 Uses

func (h *Handler) Close() error

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

func (*Handler) Handle Uses

func (h *Handler) Handle(err error)

Handle sends the error to Rollbar.

Package sentry imports 5 packages (graph). Updated 2019-08-29. Refresh now. Tools for package owners.