Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Handle exceptions by using traceback.format_exc instead of extract_tb #58

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

Merged
merged 3 commits into from
Nov 25, 2019

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.

@@ -124,7 +124,7 @@ def execute(func, event, context):
err = sys.exc_info()
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.