Skip to content

Commit

Permalink
fix exception propagation during runtime environment create (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikschubert authored Jun 5, 2023
1 parent b87667e commit d69fb6a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/localstack/custom_interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"github.com/go-chi/chi"
log "github.com/sirupsen/logrus"
"go.amzn.com/lambda/core"
"go.amzn.com/lambda/core/statejson"
"go.amzn.com/lambda/interop"
"go.amzn.com/lambda/rapidcore"
Expand Down Expand Up @@ -208,11 +209,18 @@ func (c *CustomInteropServer) SendResponse(invokeID string, contentType string,
}

func (c *CustomInteropServer) SendErrorResponse(invokeID string, response *interop.ErrorResponse) error {
log.Traceln("Function called")
err := c.localStackAdapter.SendStatus(Error, response.Payload)
is, err := c.InternalState()
if err != nil {
return err
}
rs := is.Runtime.State
if rs.Name == core.RuntimeInitErrorStateName {
err = c.localStackAdapter.SendStatus(Error, response.Payload)
if err != nil {
return err
}
}

return c.delegate.SendErrorResponse(invokeID, response)
}

Expand Down

0 comments on commit d69fb6a

Please sign in to comment.