volcstackerr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package volcstackerr represents API error interface accessors for the SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SprintError

func SprintError(code, message, extra string, origErr error) string

SprintError returns a string of the formatted error code.

Both extra and origErr are optional. If they are included their lines will be added, but if they are not included their lines will be ignored.

Types

type BatchError deprecated

type BatchError interface {
	// Satisfy the generic error interface.
	error

	// Code Returns the short phrase depicting the classification of the error.
	Code() string

	// Message Returns the error details message.
	Message() string

	// OrigErrs Returns the original error if one was set.  Nil is returned if not set.
	OrigErrs() []error
}

BatchError is a batch of errors which also wraps lower level errors with code, message, and original errors. Calling Error() will include all errors that occurred in the batch.

Deprecated: Replaced with BatchedErrors. Only defined for backwards compatibility.

type BatchedErrors

type BatchedErrors interface {
	// Error Satisfy the base Error interface.
	Error

	// OrigErrs Returns the original error if one was set.  Nil is returned if not set.
	OrigErrs() []error
}

BatchedErrors is a batch of errors which also wraps lower level errors with code, message, and original errors. Calling Error() will include all errors that occurred in the batch.

Replaces BatchError

func NewBatchError

func NewBatchError(code, message string, errs []error) BatchedErrors

NewBatchError returns an BatchedErrors with a collection of errors as an array of errors.

type Error

type Error interface {
	// Satisfy the generic error interface.
	error

	// Code Returns the short phrase depicting the classification of the error.
	Code() string

	// Message Returns the error details message.
	Message() string

	// OrigErr Returns the original error if one was set.  Nil is returned if not set.
	OrigErr() error
}

An Error wraps lower level errors with code, message and an original error. The underlying concrete error type may also satisfy other interfaces which can be to used to obtain more specific information about the error.

Calling Error() or String() will always include the full information about an error based on its underlying type.

func New

func New(code, message string, origErr error) Error

New returns an Error object described by the code, message, and origErr.

If origErr satisfies the Error interface it will not be wrapped within a new Error object and will instead be returned.

type RequestFailure

type RequestFailure interface {
	Error

	// StatusCode The status code of the HTTP response.
	StatusCode() int

	// RequestID The request ID returned by the service for a request failure. This will
	// be empty if no request ID is available such as the request failed due
	// to a connection error.
	RequestID() string
}

A RequestFailure is an interface to extract request failure information from an Error such as the request ID of the failed request returned by a service. RequestFailures may not always have a requestID value if the request failed prior to reaching the service such as a connection error.

func NewRequestFailure

func NewRequestFailure(err Error, statusCode int, reqID string, simple ...*bool) RequestFailure

NewRequestFailure returns a wrapped error with additional information for request status code, and service requestID.

Should be used to wrap all request which involve service requests. Even if the request failed without a service response, but had an HTTP status code that may be meaningful.

type UnmarshalError

type UnmarshalError interface {
	Bytes() []byte
	// contains filtered or unexported methods
}

UnmarshalError provides the interface for the SDK failing to unmarshal data.

func NewUnmarshalError

func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError

NewUnmarshalError returns an initialized UnmarshalError error wrapper adding the bytes that fail to unmarshal to the error.

Jump to

Keyboard shortcuts

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