errors

package
v0.0.0-...-395fc46 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoNotWrap

func DoNotWrap(err error) bool

DoNotWrap reports whether an error should not be wrapped in the Error type from this package. It returns true if err is a retry error, a context error, io.EOF, or if it wraps one of those.

func ErrorAs

func ErrorAs(err error, target interface{}, errorAs func(error, interface{}) bool) bool

ErrorAs is a helper for the ErrorAs method of an API's portable type. It performs some initial nil checks, and does a single level of unwrapping when err is a *gcerr.Error. Then it calls its errorAs argument, which should be a driver implementation of ErrorAs.

Types

type Error

type Error struct {
	Code gcerrors.ErrorCode
	// contains filtered or unexported fields
}

An Error describes a Go CDK error.

func New

func New(c gcerrors.ErrorCode, err error, callDepth int, msg string) *Error

New returns a new error with the given code, underlying error and message. Pass 1 for the call depth if New is called from the function raising the error; pass 2 if it is called from a helper function that was invoked by the original function; and so on.

func Newf

func Newf(c gcerrors.ErrorCode, err error, format string, args ...interface{}) *Error

Newf uses format and args to format a message, then calls New.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Format

func (e *Error) Format(s fmt.State, c rune)

func (*Error) FormatError

func (e *Error) FormatError(p xerrors.Printer) (next error)

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the error underlying the receiver, which may be nil.

Jump to

Keyboard shortcuts

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