errs

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPNotFound = HTTPErrorWithCode(NewHTTPError("resource does not exist"), 404)

	ItemNotFound = NewLibraryError("item does not exist in store")

	TooManyRetries = NewAPIError("too many retries")

	ResultMustBePointer = NewHTTPError("result must be a pointer")

	HTTPUnauthorized = HTTPErrorWithCode(NewHTTPError("invalid credentials"), 401)

	ModalValueNotFound = NewLibraryError("there is no modal component with given custom ID")
)

Functions

func Is

func Is(err error, code int) bool

func IsNotFound

func IsNotFound(err error) bool

Types

type APIError

type APIError struct {
	LibraryError
}

func NewAPIError

func NewAPIError(msg string) *APIError

func (APIError) Error

func (e APIError) Error() string

type DiscordError

type DiscordError struct {
	Message string          `json:"message"`
	Details json.RawMessage `json:"errors"`
	Code    int             `json:"code"`
}

func (DiscordError) Error

func (v DiscordError) Error() string

type HTTPError

type HTTPError struct {
	LibraryError
	Code int
}

func HTTPErrorWithCode

func HTTPErrorWithCode(err *HTTPError, code int) *HTTPError

func NewHTTPError

func NewHTTPError(msg string) *HTTPError

func (HTTPError) Error

func (e HTTPError) Error() string

type LibraryError

type LibraryError struct {
	Message string
}

func NewLibraryError

func NewLibraryError(msg string) *LibraryError

func (LibraryError) Error

func (e LibraryError) Error() string

Jump to

Keyboard shortcuts

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