errres

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateResource     = NewWithCode(http.StatusConflict, "duplicated resource")
	ErrInvalidRequest        = NewWithCode(http.StatusBadRequest, "invalid request ")
	ErrResourceNotFound      = NewWithCode(http.StatusNotFound, "resource not found")
	ErrAuthorizationRequired = NewWithCode(http.StatusUnauthorized, "authorization required")
	ErrEndpointNotFound      = NewWithCode(http.StatusNotFound, "endpoint not found")
	ErrFailedRequest         = NewWithCode(http.StatusExpectationFailed, "failed request ")
)

Functions

This section is empty.

Types

type HttpError

type HttpError struct {
	Message    string `json:"message"`
	Code       int    `json:"code"`
	InnerError error
}

func BadRequest

func BadRequest(message string, err error) *HttpError

func New

func New(message string) *HttpError

func NewWithCode

func NewWithCode(code int, message string) *HttpError

func Wrap

func Wrap(message string, err error) *HttpError

func WrapWithCode

func WrapWithCode(code int, message string, err error) *HttpError

func (*HttpError) Error

func (he *HttpError) Error() string

Jump to

Keyboard shortcuts

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