-
Notifications
You must be signed in to change notification settings - Fork 662
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
Preserve stack track of original errors #561
Comments
my first thought is "why is the error message but onto your actual point: i think you do have the entire stack trace, if you have any concrete suggestions about which library or technique you'd like to see adopted, or any info to the contrary of what i know, i'm all ears! |
it looks like if you were to reproduce your error with the inspector protocol enabled ( is this a solution for your problem? i think the resistance of using the |
others have referred to this package: https://github.com/amio-io/await-trace. i'm not sure how, or if, that will be useful. |
as if this wasn't already complicated enough, another fact to keep in mind is that this project is compiled with typescript to target ES2015, where i believe all the solutions powered by |
one more possible solution: https://medium.com/front-end-hacking/stack-traces-for-promises-in-node-js-46bf5f490fe4 |
for reference, here's two errors i created from the WebClient just now. its notable that the
|
I wanted to bump this issue up, because we're having similar problems with the
This makes it difficult to trace which call to the Slack API in our code is failing. An easy way to repro this locally is to edit
You'll notice that the first trace has the expected full stack, but the second one loses it. 🤔 This is definitely caused by The solution for this should be pretty straightforward: record the original stack trace within |
Thanks @vaskevich! In general, I agree that including the proper stack trace in valuable. I believe the solution you proposed though would have issues with debuggers such as vscode. It is also a little expensive to create a new error even when you don't plan on throwing the error every time the method is called. Do you think there might be a different solution to this problem? Is Axios preventing us from taking advantage of node v8's async stack traces? |
Could you go into detail more? Do you mean that VS Code would have trouble parsing the updated stack trace? If so, it should only be a matter of augmenting the stack trace properly.
The cost of network I/O from making API requests far exceeds the cost of creating an additional error object here, to the point where this additional allocation is insignificant, IMO.
I can't really think of an alternative solution for making sure stack traces are preserved other than capturing the trace prior to the point that Axios breaks it. See this for more details: axios/axios#2387. A minor change could be to use |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. |
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number. |
WebClient.ts
has several methods for wrapping errors from the client:https://github.com/slackapi/node-slack-sdk/blob/master/src/WebClient.ts#L678-L718
All of them create a
new Error
, which means the stack trace that is returned when these errors occur is not very helpful to users of the SDK. For example, here's the error I'm currently trying to debug:This stackoverflow discusison has some options for preserving
error.stack
when wrapping errors.What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Reproducible in:
@slack/client
version: 4.0.1node version: 8.9.4
OS version(s): macOS 10.13.4
The text was updated successfully, but these errors were encountered: