Skip to content

Conversation

danielthepope
Copy link
Contributor

This fixes #57, where we were seeing TypeError: Object of type FrameSummary is not JSON serializable if the handler function throws an exception.

traceback.format_exc returns a string that can be easily turned into JSON.

@danielthepope

This comment has been minimized.

result = json.dumps({
"errorMessage": str(err[1]),
"stackTrace": traceback.extract_tb(err[2]),
"stackTrace": traceback.format_exc(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using traceback.format_tb(err[2]) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, that makes it look more like the error response provided by AWS now.

Copy link
Contributor

@yxd-hde yxd-hde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. Would you please check my comment? Thanks!

@yxd-hde yxd-hde merged commit 9b2433e into HDE:master Nov 25, 2019
@danielthepope danielthepope deleted the handle-exceptions branch November 25, 2019 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exceptions thrown in handler function make process hang
2 participants