paddleerr

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 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 {
	Status           int               `json:"-"`
	Type             ErrorType         `json:"type"`
	Code             string            `json:"code"`
	Detail           string            `json:"detail"`
	DocumentationURL string            `json:"documentation_url"`
	Extra            map[string]any    `json:"extra"`
	Errors           []ValidationError `json:"errors,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

Error conforms to the errors interface. It returns a string representation of the error, which contains the type and code of the error, and the detail if it exists. If the documentation URL exists, it will be appended to the end of the string.

func (*Error) Is

func (e *Error) Is(target error) bool

Is returns true if the target error is a *Error and the error type and code match.

type ErrorType

type ErrorType string
const (
	ErrorTypeRequestError ErrorType = "request_error"
	ErrorTypeAPIError     ErrorType = "api_error"
)

type ValidationError

type ValidationError 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