Package: awserr

import "../ibm-cos-sdk-go/aws/awserr"

Overview

Package awserr represents API error interface accessors for the SDK.

Interface Summary collapse

Function Summary collapse

Function Details

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.



80
81
82
83
84
85
86
// File 'aws/awserr/error.go', line 80

func New(code, message string, origErr error) Error { var errs []error if origErr != nil { errs = append(errs, origErr) } return newBaseError(code, message, errs) }

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

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



90
91
92
// File 'aws/awserr/error.go', line 90

func NewBatchError(code, message string, errs []error) BatchedErrors { return newBaseError(code, message, errs) }

func NewRequestFailure(err Error, statusCode int, reqID string) 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.



144
145
146
// File 'aws/awserr/error.go', line 144

func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { return newRequestError(err, statusCode, reqID) }

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.



156
157
158
159
160
161
// File 'aws/awserr/error.go', line 156

func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError { return &unmarshalError{ awsError: New("UnmarshalError", msg, err), bytes: bytes, } }

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.



11
12
13
14
15
16
17
18
19
20
// File 'aws/awserr/types.go', line 11

func SprintError(code, message, extra string, origErr error) string { msg := fmt.Sprintf("%s: %s", code, message) if extra != "" { msg = fmt.Sprintf("%s\n\t%s", msg, extra) } if origErr != nil { msg = fmt.Sprintf("%s\ncaused by: %s", msg, origErr.Error()) } return msg }