error

package
v1.2.2-dev.18 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METHOD_NOT_ALLOWED = "isA should not be invoked, this is to only be used as a default error"
)

Variables

View Source
var Default defaultError

Functions

func NewErrContractInvalidError

func NewErrContractInvalidError(err error) *errContractInvalid

NewErrContractInvalid returns an instance of the error interface with ErrContractInvalid as its implementation.

func NewServiceClientHttpError

func NewServiceClientHttpError(err error) *serviceClientHttpError

NewServiceClientHttpError represents the accessor for the service-client-specific error concepts

Types

type ErrorHandler

type ErrorHandler interface {
	Handle(err error, ec ErrorType) HTTPErrorResponse
	HandleWithDefault(err error, allowableError ErrorType, defaultError ErrorType) HTTPErrorResponse
	HandleManyWithDefault(err error, allowableErrors []ErrorType, defaultError ErrorType) HTTPErrorResponse
}

func NewErrorHandler

func NewErrorHandler(l logger.LoggingClient) ErrorHandler

type ErrorType

type ErrorType interface {
	// contains filtered or unexported methods
}

type HTTPErrorResponse

type HTTPErrorResponse struct {
	ErrorCode  uint16
	ErrMessage string
}

type Handler

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

func (*Handler) Handle

func (e *Handler) Handle(err error, ec ErrorType) HTTPErrorResponse

Handle applies the specified error to the HTTP response writer

func (*Handler) HandleManyWithDefault

func (e *Handler) HandleManyWithDefault(err error, allowableErrors []ErrorType, defaultError ErrorType) HTTPErrorResponse

HandleManyWithDefault applies general error-handling for the specified set of allowable errors and a default error to be used as a fallback when none of the allowable errors are matched

func (*Handler) HandleWithDefault

func (e *Handler) HandleWithDefault(err error, allowableError ErrorType, defaultError ErrorType) HTTPErrorResponse

HandleWithDefault applies general error-handling with a single allowable error and a default error to be used as a fallback when none of the allowable errors are matched

Jump to

Keyboard shortcuts

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