Comments (3)
Hey @jdconley, thanks for filing this issue.
I think I understand the scenario, but let me run it by you just to be sure:
When fetch encounters a network error, it rejects the promise instead of resolving with a non-okay status code. Our fetch call wasn't in a try/catch, so whenever you encountered a network error, the global unhandled rejection event was being triggered and showing up in your logs. I've created a PR to catch the promise rejection and then explicitly throw a new error. If this all sounds right, I'll get a patch out for you.
I can go back and patch version 6 as well if you'd like, or if you'd like to upgrade to version 7, there's just a slight change to the format of the second parameter in your example: from edgeHeaders
to { headers: edgeHeaders }
from client-js.
If this all sounds right, I'll get a patch out for you.
That does sound about right, thanks. I just want to be able to know when an exception occurs so it can be handled. That could be through return codes or re-throwing. Up to your interface design. I think bubbling up the rejection makes sense in this case.
I can go back and patch version 6 as well if you'd like, or if you'd like to upgrade to version 7, there's just a slight change to the format of the second parameter in your example: from
edgeHeaders
to{ headers: edgeHeaders }
I tried the new library but the breaking change with the module format made it difficult to upgrade. I had hundreds of compiler errors to fix. It's probably going to take hours to migrate our project to the new format so I didn't want to bite that off. I would prefer a patch to 6.x.
Thanks!
from client-js.
@jdconley v6.2.1 should have the change you need. Let me know if it does the trick and I'll close this out. Also, if you don't mind sharing more about the compiler errors you were seeing with the v7 switch to es modules, I'll see if it's anything we can address.
Cheers
from client-js.
Related Issues (20)
- Errors sometimes come as JSON strings in a message HOT 1
- Incorrect stock financials field names HOT 1
- Incorrect typings for polygon's client JS file. HOT 1
- 7.2.4 is broken HOT 1
- No typescript support for websockets HOT 1
- IAggs interface is missing next_url
- Support for connection keepalives and connection pooling? HOT 6
- UniversalSnapshot types not exported
- cannot run examples HOT 4
- Stocks Aggregates crashes with "GE" stock HOT 12
- Timeouts and retries HOT 1
- Client constructor, wrong parameter type? HOT 7
- Incorrect trades order when pagination: true HOT 4
- restClient.options.snapshotOptionContract and restClient.reference.optionsContract do not always return the correct data HOT 2
- Importing in node HOT 1
- Issue with tickerDetails when pagination is enabled
- tickerNews bringing non-related-to-ticker news HOT 1
- `fmv` field missing on `UniversalSnapshotInfo` HOT 2
- `options.snapshotOptionContract` and `reference.optionsContract` are not working, returning empty array. HOT 2
- noticing the JS api does not surface errors verbosely HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client-js.