Back to godoc.org

Package errors

v0.1.74
Latest Go to latest

The latest major version is .

Published: Sep 23, 2020 | License: MIT | Module: github.com/pace/bricks

Index

func ContextTransfer

func ContextTransfer(ctx, targetCtx context.Context) context.Context

ContextTransfer copies error handling related information from one context to another.

func Handle

func Handle(ctx context.Context, rp interface{})

Handle logs the given error and reports it to sentry.

func HandleError

func HandleError(rp interface{}, handlerName string, w http.ResponseWriter, r *http.Request)

HandleError reports the passed error to sentry

func HandleErrorNoStack

func HandleErrorNoStack(ctx context.Context, err error)

func HandleRequest

func HandleRequest(handlerName string, w http.ResponseWriter, r *http.Request)

HandleRequest should be called with defer to recover panics in request handlers

func HandleWithCtx

func HandleWithCtx(ctx context.Context, handlerName string)

HandleWithCtx should be called with defer to recover panics in goroutines

func Handler

func Handler() func(http.Handler) http.Handler

Handler implements a panic recovering middleware

func Hide

func Hide(ctx context.Context, err, exposedErr error) error

Hide checks whether the given error err is a context.Canceled or context.DeadlineExceeded error and if so exposes these errors as wrapped errors while maintaining the given err as string. If the optional exposedErr is provided, it is attached as prefix to the returned error. If the given err is not any of the above ones, the given exposedErr (if present) is wrapped as prefix to the returned error.

func New

func New(text string) error

New returns an error that formats as the given text.

func WrapWithExtra

func WrapWithExtra(err error, extraInfo map[string]interface{}) error

WrapWithExtra adds extra data to an error before reporting to Sentry

type PanicWrap

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

PanicWrap wraps a panic for HandleRequest

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier