Skip to content

Commit d69fb6a

Browse files
fix exception propagation during runtime environment create (#20)
1 parent b87667e commit d69fb6a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmd/localstack/custom_interop.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"github.com/go-chi/chi"
88
log "github.com/sirupsen/logrus"
9+
"go.amzn.com/lambda/core"
910
"go.amzn.com/lambda/core/statejson"
1011
"go.amzn.com/lambda/interop"
1112
"go.amzn.com/lambda/rapidcore"
@@ -208,11 +209,18 @@ func (c *CustomInteropServer) SendResponse(invokeID string, contentType string,
208209
}
209210

210211
func (c *CustomInteropServer) SendErrorResponse(invokeID string, response *interop.ErrorResponse) error {
211-
log.Traceln("Function called")
212-
err := c.localStackAdapter.SendStatus(Error, response.Payload)
212+
is, err := c.InternalState()
213213
if err != nil {
214214
return err
215215
}
216+
rs := is.Runtime.State
217+
if rs.Name == core.RuntimeInitErrorStateName {
218+
err = c.localStackAdapter.SendStatus(Error, response.Payload)
219+
if err != nil {
220+
return err
221+
}
222+
}
223+
216224
return c.delegate.SendErrorResponse(invokeID, response)
217225
}
218226

0 commit comments

Comments
 (0)