errors

package
v0.12.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorWithCode

func IsErrorWithCode(err error, code Code) bool

Types

type Code

type Code string

Code is useful for converting to HTTP status code. In general it's a value which is machine readable.

type Error

type Error struct {
	Err           error
	Message       string
	PublicMessage string
	Code          Code
	Data          any
}

Error represents API error. All fields (except of wrapped error and message) are meant to be publicly sharable.

func NewError

func NewError(message string, code Code) *Error

func NewPublicError

func NewPublicError(publicMessage string, code Code) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithData

func (e *Error) WithData(data any) *Error

func (*Error) WithPublicMessage

func (e *Error) WithPublicMessage(msg string) *Error

func (*Error) Wrap

func (e *Error) Wrap(err error) *Error

type ResponseError

type ResponseError struct {
	model.BaseResponse

	// An HTTP status code for unsuccessful requests.
	StatusCode int
}

ResponseError represents an API response with an error status code.

func AsResponseError

func AsResponseError(obj any) (*ResponseError, bool)

func (*ResponseError) Error

func (e *ResponseError) Error() string

Error returns the details of an error response.

Jump to

Keyboard shortcuts

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