errors

package
v0.0.0-...-06bfaea Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Op   Op
	Kind Kind  // What kind of error is it?
	Err  error // optional; The underlying error that triggered this one.
}

Error represents what gets returned from the API's when something goes wrong.

func E

func E(args ...any) Error

E is a shorthand constructor for Error.

func (Error) Error

func (err Error) Error() string

func (Error) MarshalJSON

func (err Error) MarshalJSON() ([]byte, error)

func (Error) Unwrap

func (err Error) Unwrap() error

type Kind

type Kind string

Kind is an enum of the type of error

const (
	Unknown  Kind = "unknown"   // Default, unspecified reason. Seeing this means better error handling needed.
	Invalid  Kind = "invalid"   // Something is invalid about the request being made.
	NotExist Kind = "not_exist" // The item being requested does not exist.
)

func (Kind) StatusCode

func (k Kind) StatusCode() int

StatusCode gets the HTTP code implied by the kind of error.

type Op

type Op string

Op is an operation that was being tried when the error happened.

Jump to

Keyboard shortcuts

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