errcodes

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conflict

func Conflict(msg string) error

Conflict returns a 409 error with the given message.

func EmptyRequestBody

func EmptyRequestBody() error

func Forbidden

func Forbidden(action string) error

Forbidden returns a 403 error with a message indicating the action is forbidden.

func MalformedPayload

func MalformedPayload() error

func NotFound

func NotFound(resource string) error

NotFound returns a 404 error with a message indicating the given resource.

func PasswordResetRequired added in v0.0.12

func PasswordResetRequired() error

PasswordResetRequired returns a 403 error indicating the user must reset their password before continuing.

func Unauthorized

func Unauthorized(msg string) error

Unauthorized returns a 401 error with the given message.

func UnknownParameter

func UnknownParameter(param string) error

func UnsupportedMediaType

func UnsupportedMediaType() error

func ValidationError

func ValidationError(msg string) error

func ValidationTypeError

func ValidationTypeError(msg string) error

Types

type Error

type Error struct {
	HTTPCode int
	Message  string
	Code     string
}

func (*Error) As

func (err *Error) As(target interface{}) bool

func (*Error) Error

func (err *Error) Error() string

func (*Error) Is

func (err *Error) Is(target error) bool

type Handler

type Handler struct{}

func NewHandler

func NewHandler() *Handler

func (*Handler) Handle

func (h *Handler) Handle(err error, c echo.Context)

Handle is an Echo error handler that uses HTTP errors accordingly, and any generic error will be interpreted as an internal server error.

Jump to

Keyboard shortcuts

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