errors

package
v0.0.0-...-cd399ba Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeError

func EncodeError(_ context.Context, err error, w http.ResponseWriter)

EncodeError encodes errors from business-logic.

func NewErrorf

func NewErrorf(code ErrorCode, format string, a ...interface{}) error

func WrapErrorf

func WrapErrorf(original error, code ErrorCode, format string, a ...interface{}) error

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (*Error) Code

func (e *Error) Code() ErrorCode

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode int
const (
	ErrCodeUnknown ErrorCode = iota
	ErrCodeNotFound
	ErrCodeInvalidArgument
)

type ErrorResponse

type ErrorResponse struct {
	Message any `json:"message"`
	Error   any `json:"error"`
}

type ValidatorError

type ValidatorError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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