diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index 0202a00..9cf7eaf 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go | |||
@@ -1,6 +1,9 @@ | |||
1 | package awserr | 1 | package awserr |
2 | 2 | ||
3 | import "fmt" | 3 | import ( |
4 | "encoding/hex" | ||
5 | "fmt" | ||
6 | ) | ||
4 | 7 | ||
5 | // SprintError returns a string of the formatted error code. | 8 | // SprintError returns a string of the formatted error code. |
6 | // | 9 | // |
@@ -119,6 +122,7 @@ type requestError struct { | |||
119 | awsError | 122 | awsError |
120 | statusCode int | 123 | statusCode int |
121 | requestID string | 124 | requestID string |
125 | bytes []byte | ||
122 | } | 126 | } |
123 | 127 | ||
124 | // newRequestError returns a wrapped error with additional information for | 128 | // newRequestError returns a wrapped error with additional information for |
@@ -170,6 +174,29 @@ func (r requestError) OrigErrs() []error { | |||
170 | return []error{r.OrigErr()} | 174 | return []error{r.OrigErr()} |
171 | } | 175 | } |
172 | 176 | ||
177 | type unmarshalError struct { | ||
178 | awsError | ||
179 | bytes []byte | ||
180 | } | ||
181 | |||
182 | // Error returns the string representation of the error. | ||
183 | // Satisfies the error interface. | ||
184 | func (e unmarshalError) Error() string { | ||
185 | extra := hex.Dump(e.bytes) | ||
186 | return SprintError(e.Code(), e.Message(), extra, e.OrigErr()) | ||
187 | } | ||
188 | |||
189 | // String returns the string representation of the error. | ||
190 | // Alias for Error to satisfy the stringer interface. | ||
191 | func (e unmarshalError) String() string { | ||
192 | return e.Error() | ||
193 | } | ||
194 | |||
195 | // Bytes returns the bytes that failed to unmarshal. | ||
196 | func (e unmarshalError) Bytes() []byte { | ||
197 | return e.bytes | ||
198 | } | ||
199 | |||
173 | // An error list that satisfies the golang interface | 200 | // An error list that satisfies the golang interface |
174 | type errorList []error | 201 | type errorList []error |
175 | 202 | ||
@@ -181,7 +208,7 @@ func (e errorList) Error() string { | |||
181 | // How do we want to handle the array size being zero | 208 | // How do we want to handle the array size being zero |
182 | if size := len(e); size > 0 { | 209 | if size := len(e); size > 0 { |
183 | for i := 0; i < size; i++ { | 210 | for i := 0; i < size; i++ { |
184 | msg += fmt.Sprintf("%s", e[i].Error()) | 211 | msg += e[i].Error() |
185 | // We check the next index to see if it is within the slice. | 212 | // We check the next index to see if it is within the slice. |
186 | // If it is, then we append a newline. We do this, because unit tests | 213 | // If it is, then we append a newline. We do this, because unit tests |
187 | // could be broken with the additional '\n' | 214 | // could be broken with the additional '\n' |