serverless-plugin-simulate
serverless-plugin-simulate copied to clipboard
Fix Error Propagation from run.js
Fix Error Propagation from run.js when return code !== 0
What did you implement:
When invoking a local lambda function, and return code === 1 due to an error thrown from inside the Lambda function, reject(result) will be called.
This means that output.errorMessage will not be converted into a proper Error Object.
See: https://github.com/serverless-community-labs/serverless-plugin-simulate/blob/9579e5dabb5b8b0fb2fcdcbe747325057ec43e5e/lib/invoke/run.js#L69-L72
See: https://github.com/serverless-community-labs/serverless-plugin-simulate/blob/9579e5dabb5b8b0fb2fcdcbe747325057ec43e5e/lib/invoke/local.js#L65-L79
How did you implement it:
Add Promise.catch()
How can we verify it:
throw an Error inside a Lambda function that is being invoked.
Todos:
- [ ] Write tests
- [ ] Write documentation
- [ ] Fix linting errors
- [ ] Provide verification config/commands/resources
- [ ] Change ready for review message below
Is this ready for review?: YES