errres

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 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
	Data       interface{} `json:"data"`
}

func BadReq added in v0.2.10

func BadReq(message string, err error, data interface{}) *HttpError

func BadRequest

func BadRequest(message string, err error) *HttpError

func Dup added in v0.2.10

func Dup(message string, err error, data interface{}) *HttpError

func New

func New(message string) *HttpError

func NewWithCode

func NewWithCode(code int, message string) *HttpError

func Unauth added in v0.2.10

func Unauth(message string, err error, data interface{}) *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