Documentation ¶
Index ¶
- func ContextTransfer(ctx, targetCtx context.Context) context.Context
- func Handle(ctx context.Context, rp interface{})
- func HandleError(rp interface{}, handlerName string, w http.ResponseWriter, r *http.Request)
- func HandleErrorNoStack(ctx context.Context, err error)
- func HandleRequest(handlerName string, w http.ResponseWriter, r *http.Request)
- func HandleWithCtx(ctx context.Context, handlerName string)
- func Handler() func(http.Handler) http.Handler
- func Hide(ctx context.Context, err, exposedErr error) error
- func IsStdLibContextError(err error) bool
- func New(text string) error
- func WrapWithExtra(err error, extraInfo map[string]interface{}) error
- type BricksError
- type BricksErrorOption
- type PanicWrap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextTransfer ¶ added in v0.1.17
ContextTransfer copies error handling related information from one context to another.
func HandleError ¶
func HandleError(rp interface{}, handlerName string, w http.ResponseWriter, r *http.Request)
HandleError reports the passed error to sentry
func HandleErrorNoStack ¶ added in v0.1.29
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 ¶
HandleWithCtx should be called with defer to recover panics in goroutines
func Hide ¶ added in v0.1.56
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, if there is an err that is not nil.
func IsStdLibContextError ¶ added in v0.4.3
func WrapWithExtra ¶
WrapWithExtra adds extra data to an error before reporting to Sentry
Types ¶
type BricksError ¶ added in v0.4.13
type BricksError struct {
// contains filtered or unexported fields
}
BricksError - a bricks err is a bricks specific error which provides convenience functions to be transformed into runtime.Errors (JSON errors) pb generate can be used to create a set of pre defined BricksErrors based on a JSON specification, see pb generate for details
func NewBricksError ¶ added in v0.4.13
func NewBricksError(opts ...BricksErrorOption) *BricksError
func (*BricksError) AsRuntimeError ¶ added in v0.4.13
func (e *BricksError) AsRuntimeError() *runtime.Error
AsRuntimeError - returns the BricksError as bricks runtime.Error which aligns with a JSON error object
func (*BricksError) Code ¶ added in v0.4.13
func (e *BricksError) Code() string
func (*BricksError) Detail ¶ added in v0.4.13
func (e *BricksError) Detail() string
func (*BricksError) Error ¶ added in v0.4.13
func (e *BricksError) Error() string
func (*BricksError) Status ¶ added in v0.4.13
func (e *BricksError) Status() int
func (*BricksError) Title ¶ added in v0.4.13
func (e *BricksError) Title() string
type BricksErrorOption ¶ added in v0.4.13
type BricksErrorOption func(e *BricksError)
func WithCode ¶ added in v0.4.13
func WithCode(s string) BricksErrorOption
func WithDetail ¶ added in v0.4.13
func WithDetail(s string) BricksErrorOption
func WithStatus ¶ added in v0.4.13
func WithStatus(s int) BricksErrorOption
func WithTitle ¶ added in v0.4.13
func WithTitle(s string) BricksErrorOption