errutils

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomHTTPErrorHandler

func CustomHTTPErrorHandler(err error, c echo.Context)

func GetStackField

func GetStackField(err error) errorField

Types

type Error

type Error struct {
	Status       ErrorStatus
	Message      string
	StackErr     error
	DebugMessage string
	ErrFields    []string
}

func NewError

func NewError(err error, errStatus ErrorStatus) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) ToEchoError

func (e *Error) ToEchoError() error

func (*Error) WithDebugMessage

func (e *Error) WithDebugMessage(debugMessage string) *Error

func (*Error) WithFields added in v1.1.1

func (e *Error) WithFields(fields ...string) *Error

func (*Error) WithMessage

func (e *Error) WithMessage(message string) *Error

type ErrorStatus

type ErrorStatus string
const (
	BadRequest           ErrorStatus = "BAD_REQUEST"
	InternalError        ErrorStatus = "INTERNAL_ERROR"
	Unauthorized         ErrorStatus = "UNAUTHORIZED"
	Forbidden            ErrorStatus = "FORBIDDEN"
	NotFound             ErrorStatus = "NOT_FOUND"
	Conflict             ErrorStatus = "CONFLICT"
	UnsupportedMediaType ErrorStatus = "UNSUPPORTED_MEDIA_TYPE"
	UnprocessableEntity  ErrorStatus = "UNPROCESSABLE_ENTITY"
	TooManyRequests      ErrorStatus = "TOO_MANY_REQUESTS"
	InternalServerError  ErrorStatus = "INTERNAL_SERVER_ERROR"
)

func (ErrorStatus) StatusCode

func (e ErrorStatus) StatusCode() int

func (ErrorStatus) String

func (e ErrorStatus) String() string

type RestErrorResponse

type RestErrorResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StackTracer

type StackTracer interface {
	StackTrace() errors.StackTrace
}

Jump to

Keyboard shortcuts

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