errcodes

package
v1.31.5-0...-ff97089 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PGDeadlockDetectedCode = "40P01"
	PGUniqueViolationCode  = "23505"
	PGUserCancel           = "57014"
)

Constants for Postgres error codes as found here: https://www.postgresql.org/docs/10/static/errcodes-appendix.html.

Variables

This section is empty.

Functions

func AtLeastOneDex

func AtLeastOneDex() error

func BadAuthHeaderFormat

func BadAuthHeaderFormat() error

func CannotParseToken

func CannotParseToken() error

func EmptyRequestBody

func EmptyRequestBody() error

func EmptySlug

func EmptySlug() error

func ExistingDex

func ExistingDex() error

func ExistingUsername

func ExistingUsername() error

func Forbidden

func Forbidden(action string) error

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

func GameDexTypeMismatch

func GameDexTypeMismatch() error

func InvalidJWT

func InvalidJWT() error

func InvalidJWTSignature

func InvalidJWTSignature() error

func InvalidPassword

func InvalidPassword() error

func IsPGDeadlockDetected

func IsPGDeadlockDetected(err error) bool

func IsPGUniqueViolation

func IsPGUniqueViolation(err error) bool

func IsPGUserCancel

func IsPGUserCancel(err error) bool

func MalformedPayload

func MalformedPayload() error

func MissingAuthentication

func MissingAuthentication() error

func NotFound

func NotFound(resource string) error

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

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