errors

package
v0.0.0-...-de503a1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As is a wrapper around the native errors.As function.

func E

func E(op Op, args ...any) error

E creates a new Error with the given op and arguments. The arguments can be 1: an error, 2: a M instance, 3: an int status code.

func Is

func Is(err error, target error) bool

Is is a wrapper around the native errors.Is function.

func Strf

func Strf(format string, args ...any) error

Strf is a wrapper around the fmt.Errorf function.

Types

type Error

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

Error is an error that occured during execution. Includes any error messages and HTTP status code for the response. Implements the Error interface.

func (*Error) Error

func (e *Error) Error() string

Error returns a string containing all the error information. This should not be passed down to any HTTP responses.

func (*Error) Message

func (e *Error) Message() M

Message returns a map of the error messages to be returned in the HTTP response.

func (*Error) Status

func (e *Error) Status() int

Status returns the HTTP status code for the error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the current error's underlying error if there is one.

type M

type M map[string][]string

M is a type alias for a map of string to string slice.

type Op

type Op string

Op is the operation being performed, usually the package and method name.

Jump to

Keyboard shortcuts

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