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

Don't require throw to add trace info for verbose mode #1317

Merged
merged 1 commit into from
Apr 28, 2020
Merged

Don't require throw to add trace info for verbose mode #1317

merged 1 commit into from
Apr 28, 2020

Conversation

mmghv
Copy link
Contributor

@mmghv mmghv commented Apr 27, 2020

Fixes #1316

Currently, verbose() adds trace info to the error object only if you throw the error by catching it inside a try/catch :

https://github.com/mapbox/node-sqlite3/blob/afa22076ba13ef3bc6afac892d9ed46a7ec36fc2/lib/trace.js#L18-L28

This doesn't work with promises as discussed in the linked issue because throwing in an async callback doesn't get caught by the promise or a wrapping try/catch.

this PR solves this issue by simply adding the trace info outside try/catch by checking the error object which is always the first argument.

@kewde
Copy link
Collaborator

kewde commented Apr 27, 2020

Thank you for the contribution @mmghv.
I am currently working on release 5.0.0 and will include this tonight.

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.

Verbose doesn't work with pormises
2 participants