]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go
update vendor and go.mod
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / aws / awserr / types.go
index 0202a008f5d7dec3c76a1e5bebe813a8b8b2593b..9cf7eaf4007f544fdbbb060ac3d1a60f94623219 100644 (file)
@@ -1,6 +1,9 @@
 package awserr
 
-import "fmt"
+import (
+       "encoding/hex"
+       "fmt"
+)
 
 // SprintError returns a string of the formatted error code.
 //
@@ -119,6 +122,7 @@ type requestError struct {
        awsError
        statusCode int
        requestID  string
+       bytes      []byte
 }
 
 // newRequestError returns a wrapped error with additional information for
@@ -170,6 +174,29 @@ func (r requestError) OrigErrs() []error {
        return []error{r.OrigErr()}
 }
 
+type unmarshalError struct {
+       awsError
+       bytes []byte
+}
+
+// Error returns the string representation of the error.
+// Satisfies the error interface.
+func (e unmarshalError) Error() string {
+       extra := hex.Dump(e.bytes)
+       return SprintError(e.Code(), e.Message(), extra, e.OrigErr())
+}
+
+// String returns the string representation of the error.
+// Alias for Error to satisfy the stringer interface.
+func (e unmarshalError) String() string {
+       return e.Error()
+}
+
+// Bytes returns the bytes that failed to unmarshal.
+func (e unmarshalError) Bytes() []byte {
+       return e.bytes
+}
+
 // An error list that satisfies the golang interface
 type errorList []error
 
@@ -181,7 +208,7 @@ func (e errorList) Error() string {
        // How do we want to handle the array size being zero
        if size := len(e); size > 0 {
                for i := 0; i < size; i++ {
-                       msg += fmt.Sprintf("%s", e[i].Error())
+                       msg += e[i].Error()
                        // We check the next index to see if it is within the slice.
                        // If it is, then we append a newline. We do this, because unit tests
                        // could be broken with the additional '\n'