Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception returns successfully #3

Open
jpbarto opened this issue Feb 7, 2020 · 4 comments · Fixed by #4
Open

Exception returns successfully #3

jpbarto opened this issue Feb 7, 2020 · 4 comments · Fixed by #4
Labels
enhancement New feature or request

Comments

@jpbarto
Copy link
Contributor

jpbarto commented Feb 7, 2020

When setting 'failureMode' to 'exception' the Lambda function returns successfully, an exception occurs but the Lambda function succeeds.

START RequestId: 303ca17f-a63c-44ce-a38e-9236e3db57c2 Version: $LATEST
2020-02-07T14:18:14.839Z	303ca17f-a63c-44ce-a38e-9236e3db57c2	INFO	Injecting exception message: Exception message!
2020-02-07T14:18:14.852Z	303ca17f-a63c-44ce-a38e-9236e3db57c2	INFO	Error: Exception message!
    at Runtime.handler (/var/task/node_modules/failure-lambda/lib/failure.js:31:17)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)END RequestId: 303ca17f-a63c-44ce-a38e-9236e3db57c2
REPORT RequestId: 303ca17f-a63c-44ce-a38e-9236e3db57c2	Duration: 142.89 ms	Billed Duration: 200 ms	Memory Size: 128 MB	Max Memory Used: 96 MB	

I would have expected a thrown exception to cause the Lambda function to fail.

@gunnargrosch
Copy link
Owner

Not throwing the exception is an oversight from my end in the rush to release on Christmas eve. It should of course do that. :)

So with that and your PR for catchException flag in mind, do you see any scenario when we don't want to throw the exception?

@gunnargrosch
Copy link
Owner

Merged part of the code to fix the issue with not throwing the exception and published a new version of the package. The question if we want catchException flag is still open.

@jpbarto
Copy link
Contributor Author

jpbarto commented Feb 16, 2020

@gunnargrosch my thinking was that there may be merit to wanting the Lambda function to exit with an error without necessarily reporting the error to Lambda. Putting potentially dangerous code inside a try / catch is very common in my experience - so I think it would be valuable to have as a feature.

@gunnargrosch gunnargrosch added the enhancement New feature or request label Feb 16, 2020
@gunnargrosch
Copy link
Owner

@jpbarto Sounds good to me! To keep this as a minor update I would like the setting in the parameter to be optional. Would mean that users don't have change their parameters to use the new version. I guess that means a simple if statement by the newly added throw ex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants