httperror

package
v0.0.0-...-eef2c6e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidDateFormat  = ErrorCode{"InvalidDateFormat", 422}
	InvalidFormat      = ErrorCode{"InvalidFormat", 422}
	InvalidReference   = ErrorCode{"InvalidReference", 422}
	NotNullable        = ErrorCode{"NotNullable", 422}
	NotUnique          = ErrorCode{"NotUnique", 422}
	MinLimitExceeded   = ErrorCode{"MinLimitExceeded", 422}
	MaxLimitExceeded   = ErrorCode{"MaxLimitExceeded", 422}
	MinLengthExceeded  = ErrorCode{"MinLengthExceeded", 422}
	MaxLengthExceeded  = ErrorCode{"MaxLengthExceeded", 422}
	InvalidOption      = ErrorCode{"InvalidOption", 422}
	InvalidCharacters  = ErrorCode{"InvalidCharacters", 422}
	MissingRequired    = ErrorCode{"MissingRequired", 422}
	InvalidCSRFToken   = ErrorCode{"InvalidCSRFToken", 422}
	InvalidAction      = ErrorCode{"InvalidAction", 422}
	InvalidBodyContent = ErrorCode{"InvalidBodyContent", 422}
	InvalidType        = ErrorCode{"InvalidType", 422}
	ActionNotAvailable = ErrorCode{"ActionNotAvailable", 404}
	InvalidState       = ErrorCode{"InvalidState", 422}
	ServerError        = ErrorCode{"ServerError", 500}

	MethodNotAllowed = ErrorCode{"MethodNotAllow", 405}
	NotFound         = ErrorCode{"NotFound", 404}
)

Functions

func ErrorHandler

func ErrorHandler(request *types.APIContext, err error)

func NewAPIError

func NewAPIError(code ErrorCode, message string) error

func NewFieldAPIError

func NewFieldAPIError(code ErrorCode, fieldName, message string) error

func WrapAPIError

func WrapAPIError(err error, code ErrorCode, message string) error

func WrapFieldAPIError

func WrapFieldAPIError(err error, code ErrorCode, fieldName, message string) error

Types

type APIError

type APIError struct {
	Cause error
	// contains filtered or unexported fields
}

func (*APIError) Error

func (a *APIError) Error() string

type ErrorCode

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

func (ErrorCode) String

func (e ErrorCode) String() string

Jump to

Keyboard shortcuts

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