sentryhandler

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler is responsible for sending errors to Sentry.

func New

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

New creates a new handler.

Example
package main

import (
	"github.com/goph/emperror/handler/sentryhandler"
)

func main() {
	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

}
Output:

func NewFromClient

func NewFromClient(client *raven.Client) *Handler

NewFromClient creates a new handler from a client instance.

Example
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
Output:

func NewSync

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

NewSync creates a new handler that sends errors synchronously.

Example
package main

import (
	"github.com/goph/emperror/handler/sentryhandler"
)

func main() {
	dsn := "https://user:password@sentry.io/1234"

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

}
Output:

func NewSyncFromClient

func NewSyncFromClient(client *raven.Client) *Handler

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

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

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

handler := sentryhandler.NewSyncFromClient(client)
defer handler.Close()
Output:

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.

Jump to

Keyboard shortcuts

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