bricks: github.com/pace/bricks/maintenance/errors Index | Files | Directories

package errors

import "github.com/pace/bricks/maintenance/errors"

Index

Package Files

context.go error.go

func ContextTransfer Uses

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

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

func Handle Uses

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

Handle logs the given error and reports it to sentry.

func HandleError Uses

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

HandleError reports the passed error to sentry

func HandleErrorNoStack Uses

func HandleErrorNoStack(ctx context.Context, err error)

func HandleRequest Uses

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

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

func HandleWithCtx Uses

func HandleWithCtx(ctx context.Context, handlerName string)

HandleWithCtx should be called with defer to recover panics in goroutines

func Handler Uses

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

Handler implements a panic recovering middleware

func Hide Uses

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 Uses

func New(text string) error

New returns an error that formats as the given text.

func WrapWithExtra Uses

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

WrapWithExtra adds extra data to an error before reporting to Sentry

type PanicWrap Uses

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

PanicWrap wraps a panic for HandleRequest

Directories

PathSynopsis
ravenPackage raven implements a client for the Sentry error logging service.

Package errors imports 14 packages (graph) and is imported by 4 packages. Updated 2020-08-06. Refresh now. Tools for package owners.