errors

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package errors defines some sensible defaults for jenny generated services

Index

Constants

This section is empty.

Variables

View Source
var New = errors.New

New is the std lib errrors.New

Functions

func DefaultErrorEncoder

func DefaultErrorEncoder(ctx context.Context, err error, w http.ResponseWriter)

DefaultErrorEncoder is the default jenny encoder for errors. You can change this setting in the options package

func ErrorReporter

func ErrorReporter(reporter Reporter, op string) endpoint.Middleware

ErrorReporter is a special middleware that works similary to the tracing middleware, it requires what the operationID should be inorder to report it's errors

Types

type HTTPError

type HTTPError interface {
	error
	kitthttp.StatusCoder
}

HTTPError error is an interface to signal jenny whether a error should be displayed as is to the public or be obfuscated

func NewHTTPError

func NewHTTPError(err error, code int) HTTPError

NewHTTPError wraps an err with a HTTP status code

type NoopReporter

type NoopReporter struct{}

NoopReporter is the default reporter, it does nothing

func (NoopReporter) Report

Report does nothing

type Reporter

type Reporter interface {
	Report(context.Context, error, string)
}

Reporter is an interface used to report errors to an error reporting service like sentry or rollbar

Directories

Path Synopsis
Package sentry implements the Reporter interface defined in errors for sentry see sentry at https://sentry.io/welcome/
Package sentry implements the Reporter interface defined in errors for sentry see sentry at https://sentry.io/welcome/

Jump to

Keyboard shortcuts

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