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

Improve error handling #307

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bradjones1
Copy link

Fixes #306

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.96 ⚠️

Comparison is base (0348af2) 99.27% compared to head (906985a) 98.32%.

❗ Current head 906985a differs from pull request most recent head 6e31baf. Consider uploading reports for the commit 6e31baf to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
- Coverage   99.27%   98.32%   -0.96%     
==========================================
  Files          11       11              
  Lines         416      418       +2     
  Branches       64       70       +6     
==========================================
- Hits          413      411       -2     
  Misses          3        3              
- Partials        0        4       +4     
Impacted Files Coverage Δ
src/transports/EventEmitterTransport.ts 96.66% <66.66%> (-3.34%) ⬇️
src/transports/HTTPTransport.ts 97.72% <66.66%> (-2.28%) ⬇️
src/transports/TransportRequestManager.ts 97.84% <66.66%> (-1.06%) ⬇️
src/transports/WebSocketTransport.ts 97.14% <66.66%> (-2.86%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bradjones1
Copy link
Author

Surprisingly, this doesn't break any tests! Probably means we need to add testing for this :-)

const status = this.pendingRequest[id as string];
if (status) {
delete this.pendingRequest[id as string];
if (error === undefined) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key change. We may have an error response, which per the spec should result in an error response. The prior code block only checked to see if we were expecting the response with a particular ID, and early-returned. The processResult method would still reject the promise, however it would not return an error object.

@bradjones1 bradjones1 changed the title Bubble up errors by passing them through. Improve error handling Mar 21, 2023
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.

Original error object is not available in thrown error
1 participant