-
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
Append original stack when WebClient#apiCall throws #1086
base: main
Are you sure you want to change the base?
Conversation
return result; | ||
return result; | ||
} catch (err) { | ||
err.stack += `\n${originalStack}`; |
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.
This currently looks as follows:
Error: An API error occurred: account_inactive
at Object.platformErrorFromResult (/project/node_modules/@slack/web-api/src/errors.ts:94:5)
at WebClient.apiCall (/project/node_modules/@slack/web-api/src/WebClient.ts:188:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Error: thrown by
at WebClient.apiCall (/project/node_modules/@slack/web-api/dist/WebClient.js:120:40)
at /project/my_file.ts:288:19
Happy to tweak as needed.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1086 +/- ##
==========================================
+ Coverage 94.34% 94.37% +0.02%
==========================================
Files 12 12
Lines 796 800 +4
Branches 177 177
==========================================
+ Hits 751 755 +4
Misses 15 15
Partials 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. |
Hey @vaskevich! Thanks for sending this in. Ended up commenting on the issue to continue discussion |
This would really improve the developer experience. Currently, errors thrown by the web client are only referencing the stack as they know it when the promise is being resolved. This means we often cannot determine the source of the error without painstaking debugging and isolation steps. |
Summary
When an API call within
@slack/web-api
fails, the resulting error's stack loses the call context:This PR appends the original stack leading up to the call so that developers can more easily trace failing calls.
For more details, see #561 (comment)
Requirements (place an
x
in each[ ]
)