errors

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(e1, e2 error) bool

func Unwrap

func Unwrap(err error) (error, error)

func Wrap

func Wrap(wrapper, err error) error

Types

type Error

type Error interface {
	Error() string

	Msg() string

	Err() Error

	MarshalJSON() ([]byte, error)
}

func New

func New(text string) Error

type SDKError

type SDKError interface {
	Error
	StatusCode() int
}

SDKError is an error type for Magistrala SDK.

func CheckError

func CheckError(resp *http.Response, expectedStatusCodes ...int) SDKError

CheckError will check the HTTP response status code and matches it with the given status codes. Since multiple status codes can be valid, we can pass multiple status codes to the function. The function then checks for errors in the HTTP response.

func NewSDKError

func NewSDKError(err error) SDKError

NewSDKError returns an SDK Error that formats as the given text.

func NewSDKErrorWithStatus

func NewSDKErrorWithStatus(err error, statusCode int) SDKError

NewSDKErrorWithStatus returns an SDK Error setting the status code.

Jump to

Keyboard shortcuts

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