errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FromString is the Code identifying Errors created by string types
	FromString = iota + 1
	// FromError is the Code identifying Errors created by error types
	FromError
	// FromStringer is the Code identifying Errors created by fmt.Stringer types
	FromStringer
)

Variables

This section is empty.

Functions

func CoupleAPIErrors

func CoupleAPIErrors(r *resty.Response, err error) (*resty.Response, error)

Types

type APIError

type APIError struct {
	Errors []APIErrorReason `json:"errors"`
}

APIError is the set of errors returned by the Linode API on an invalid request.

func (APIError) Error

func (e APIError) Error() string

type APIErrorReason

type APIErrorReason struct {
	Reason string `json:"reason"`
	Field  string `json:"field"`
}

APIErrorReason represents an individual invalid request message returned by the Linode API.

func (APIErrorReason) Error

func (r APIErrorReason) Error() string

type Error

type Error struct {
	Response *http.Response
	Code     int
	Message  string
}

Error represents an Error in the context of an API method call.

func New

func New(err interface{}) *Error

New creates a Error with a Code identifying the source err type. - FromString (1) from a string - FromError (2) for an error - FromStringer (3) for a Stringer - HTTP Status Codes (100-600) for a resty.Response object

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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