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

precaptureStackTraces does not enhance stack traces for common errors. #722

Closed
radicaled opened this issue Feb 5, 2021 · 3 comments
Closed
Labels
Bug A code defect that needs to be fixed.

Comments

@radicaled
Copy link

For common mistakes, like a malformed AQL query via db.query, or an operation like db.save on an edge collection missing _to or _from, the stack traces arangojs generates aren't coherent even with precaptureStackTraces.

I think that's because error responses from the server don't have the enhanced stack traces added to them? EG

reject(new ArangoError(res));

These kinds of errors account for almost all the errors I see, so it would be great if precaptureStackTraces enhanced these ones as well.

@radicaled
Copy link
Author

Some minor experimentation indicates that modifying

reject(new ArangoError(res));
to append task.stack to the ArangoError used for rejecting the promise improves error diagnostics considerably.

Would a PR that appends stack traces generated by precaptureStackTraces to these kinds of errors be accepted?

@pluma
Copy link
Contributor

pluma commented Feb 11, 2021

Looking at this code now, I'm not sure when the stack traces even get added. I'm pretty sure the intention was to also augment the stack traces of HttpErrors and ArangoErrors but I think they're currently bypassing that logic entirely so this probably only affects network errors or something?

I'll look into this.

@pluma pluma added the Bug A code defect that needs to be fixed. label Feb 11, 2021
@radicaled
Copy link
Author

... but I think they're currently bypassing that logic entirely so this probably only affects network errors or something?

I believe this is correct: I've only ever seen precaptureStackTrace seem to work when I can't connect to my local ArangoDB instance because I haven't brought it up yet. Currently we're using a framework to capture and enhance ArangoDB errors locally via Error.captureStackTrace + dumping any provided AQL queries into the exception text, but it'd be great to see precatureStackTrace working across more error situations so we can drop that part from our codebase.

@pluma pluma closed this as completed in 4130b16 Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A code defect that needs to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants