errorx

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadParamsError

func BadParamsError(c echo.Context, err error) error

func BadRequestError

func BadRequestError(c echo.Context, err error) error

func ErrorCodeStrings

func ErrorCodeStrings() []string

ErrorCodeStrings returns a slice of all String values of the enum

func InternalError

func InternalError(c echo.Context) error

func ValidationFailedError added in v0.4.18

func ValidationFailedError(c echo.Context, err error) error

Types

type ErrorCode

type ErrorCode int
const (
	ErrorCodeBadRequest ErrorCode = iota + 1
	ErrorCodeValidationFailed
	ErrorCodeBadParams
	ErrorCodeInternalError
)

func ErrorCodeString

func ErrorCodeString(s string) (ErrorCode, error)

ErrorCodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ErrorCodeValues

func ErrorCodeValues() []ErrorCode

ErrorCodeValues returns all values of the enum

func (ErrorCode) IsAErrorCode

func (i ErrorCode) IsAErrorCode() bool

IsAErrorCode returns "true" if the value is listed in the enum definition. "false" otherwise

func (ErrorCode) MarshalJSON

func (i ErrorCode) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ErrorCode

func (ErrorCode) String

func (i ErrorCode) String() string

func (*ErrorCode) UnmarshalJSON

func (i *ErrorCode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ErrorCode

func (ErrorCode) Values

func (ErrorCode) Values() []string

type ErrorResponse

type ErrorResponse struct {
	Error     string    `json:"error"`
	ErrorCode ErrorCode `json:"error_code"`
	Details   string    `json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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