Skip to content

Commit

Permalink
fix(awslambda): reports AWS error details.
Browse files Browse the repository at this point in the history
  • Loading branch information
outofcoffee committed Jan 8, 2023
1 parent 851e9ef commit 5800e20
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion remote/awslambda/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package awslambda
import (
"archive/zip"
"bytes"
"errors"
"fmt"
"gatehill.io/imposter/engine"
"gatehill.io/imposter/remote"
Expand Down Expand Up @@ -210,7 +211,13 @@ func createFunction(
Environment: buildEnv(),
})
if err != nil {
return "", fmt.Errorf("failed to create function %s in region %s: %v", funcName, region, err)
var errDetail error
if awsErr, ok := err.(awserr.Error); ok {
errDetail = errors.New(awsErr.Error())
} else {
errDetail = err
}
return "", fmt.Errorf("failed to create function %s in region %s: %v", funcName, region, errDetail)
}
logger.Infof("created function: %s with arn: %s", funcName, *result.FunctionArn)
return *result.FunctionArn, nil
Expand Down

0 comments on commit 5800e20

Please sign in to comment.