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

Add stacktraces to EventHandler error logging #340

Merged
merged 4 commits into from
Feb 17, 2020

Conversation

davydog187
Copy link
Contributor

Issue

#303

Description

This PR logs the stacktrace when a user-written EventHandler raises an error.

Note that I hacked in a test scenario, there might be a better way of doing that. I'm open to suggestions.

Screen Shot 2020-02-16 at 9 35 45 AM

{:error, reason, stacktrace} ->
Logger.error(fn ->
describe(state) <>
" failed to handle event #{inspect(event)} due to: #{inspect(reason)}"
Copy link
Contributor Author

@davydog187 davydog187 Feb 16, 2020

Choose a reason for hiding this comment

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

In the future, I would suggest we move to the Exception formatter to log these. I can open another issue if we think that's a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the pretty option to inspect the error messages. It makes the log much easier to read.

Screen Shot 2020-02-17 at 7 26 21 AM

@slashdotdash
Copy link
Member

Thanks Dave.

@slashdotdash slashdotdash merged commit 4095d6f into commanded:master Feb 17, 2020
@davydog187 davydog187 deleted the better-stack-traces branch February 17, 2020 13:57
slashdotdash added a commit that referenced this pull request Feb 17, 2020
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.

2 participants