Skip to content
Snippets Groups Projects
Commit 6c47a19e authored by Jano Hendriks's avatar Jano Hendriks
Browse files

Add function to get an AWS error without its exception code

parent ec8ffa9b
Branches
Tags v1.95.0
No related merge requests found
......@@ -2,6 +2,7 @@ package errors
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/awserr"
pkg_errors "github.com/pkg/errors"
)
......@@ -111,6 +112,17 @@ func HTTPWithError(code int, err error) error {
return wrappedErr
}
func AWSErrorWithoutExceptionCode(err error) error {
if err == nil {
return nil
}
if awsError, ok := err.(awserr.Error); ok {
return Error(awsError.Message())
}
return err
}
type Description struct {
Message string `json:"error"`
Source *CallerInfo `json:"source,omitempty"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment