-
Notifications
You must be signed in to change notification settings - Fork 691
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
Why do errors have no stacktrace? #1364
Comments
Well, there is a memory dump when you cause a segfault in NodeGit or libgit2. It comes in the form of disassembly, though, so if you are not keen on parsing through pointer information they don't often help much. You can glean some info from them, however. As for your concern, we generate errors directly from libgit2, so the error you see is simply the returned error code and error message from the libgit2 routine that we invoked via NodeGit. There isn't really a "stack trace" as you know it. You run one method at a time from NodeGit, so if you get an error you should be able to deduce where it is coming from with a little work. That is all of the information we receive back from libgit2 so there isn't much else we can give you. If you want to try and get a stack trace yourself, you can try using something like this to manually grab a trace from libgit2. Although, I have never done that so I cannot speak for its effectiveness. |
I think the issue here is that it's not at all obvious where the error is coming from in a long promise chain given the (mostly) asynchronous nature of NodeGit. If libgit2 doesn't provide a stack trace of C functions, can NodeGit not provide a stack trace of JavaScript functions? |
We might be able to add some code to our generators to, at the very least, return what routine threw the error. I would need to look at the code that generates the async functions again, but I feel like that minimal solution might not be too bad to implement. What do you think of something like appending the function name to the error as some property, like |
Yeah that "solution" has been a verbally discussed intent for a long time, just nobody ever had time to get to it. Super useful though, most likely, even if just to aid in bug reporting or requesting help more than in direct debugging. |
Maybe if I get time this weekend I will draft something up. It would be helpful, I agree. |
@cjhoward92 For the function's name, what are you thinking of? The libgit2 C function like |
The name of the function you call from NodeGit. So |
That seems more logical to me, as we want this for debugging in JavaScript |
I've submitted pull request #1393 which adds a new |
I'll leave it in here In case anyone has this problem. To fix stacktraces I created this function:
Then I wrap every nodegit call with it.
A bit hacky but this way I'm getting nice error messages:
|
It's super annoying, that errors don't contain a stacktrace.
They contain absolutely no helpful information.
Is there a way to fix this?
The text was updated successfully, but these errors were encountered: