-
Notifications
You must be signed in to change notification settings - Fork 147
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
Errors from Result will now contain the caller stack trace #303
Errors from Result will now contain the caller stack trace #303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely useful! 👍
Hi @legraphista, Thanks for this PR. I definitely agree that having "real" stacktrace is valuable. |
Hey @lutovich, That was my first approach, but then you'd loose backwards compatibility with anything that was dependent on that stack trace. But if you'd like, I can update the branch to replace the original stack trace. |
@legraphista do you think there might be some code out there that depends on the stacktrace? |
Yes @lutovich, it's uncommon to parse the stack traces, I was thinking more from a logging side of things. But I think you're right, the old stack traces don't offer you much in terms of locating the issue, might as well just fully replace them. |
I've pushed the change, new stack trace example looks like:
|
7271b55
to
87b644e
Compare
@legraphista thanks, change looks good to me. |
@legraphista merged, thanks again! |
Consider the following code:
Before, when the execution had an error, we would get the following stack track:
In this case is easy to pinpoint the issue, but in a broader environment where there are a lot of queries, like for example in an API endpoint, It's hard find the bad one, even harder if the error doesn't contain any cypher at all for you to try to match against.
This change stores the current calling stack trace in
this._stack
in the constructor ofResult
and concatenates it with the original stack trace ofResult
in cases whenResult
throws an error.With the new stack trace, the location of the issue is immediately available to the developer to look at and fix.
Also included test for it and all the other test are passing.