-
Notifications
You must be signed in to change notification settings - Fork 60
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
(Bugfix) Resolve issue where calling originalFetch can throw an unhandled rejection. #433
(Bugfix) Resolve issue where calling originalFetch can throw an unhandled rejection. #433
Conversation
We're currently trying to trial Raygun as a solution and keep hitting this issue preventing us from giving it a thorough run 😅 any feedback or review is appreciated 😄 |
Great work here @Codex-! appreciate the explanation & the diagrams 🤩
I've also updated your trial end date (12 Dec) to ensure you get to properly test out Raygun! Always love seeing community submissions on our OSS & I'd love to say thank you! |
Thanks for this, although I did a quick check over the new minified code and found the patch has not been applied 😭 : var i = c.apply(null, arguments);
try {
var s = { method: n, requestURL: r, baseUrl: a };
t && t.body && (s.body = t.body),
u.executeHandlers(u.requestHandlers, s),
i.then(
...
),
i.catch(
...
); Where
Thank you, we really appreciate it.
Will do 😄 |
Apologies - try now @Codex-, I had originally built the master branch from your fork. The snippet should now target the I also tried to build the |
Great! Thanks for doing that, i'll take another look at that PR :) |
You should be able to build the provider with |
Yup found the grunt script and got it working, almost nostalgic using grunt again 😅, building now and some more diagrams added to that PR, let's move that discussion over there 👍 |
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.
All good, thanks :D
This has now been released to production :D |
awesome, thanks! |
This PR does the same change as #375 but I already made the change before noticing this PR and have some explanation around the fix 😅
Currently the existing code for
processFetch
callsoriginalFetch
and stores the promise, it then attempts to attach a chain to the original promise to fork the promise resolution for raygun specific handling of things. This is fine except thecatch
is attached to the parent promise instead of the newthen
chain which has been added to the original promise.This consequently means that if the newly attached
then
chain throws an exception it is not handled.Original flow:
This small change attaches the
catch
to the newthen
and handles throw errors as what appears to be the original intention of the code:There are a number of other small oddities I noticed when tracking this down in this prototype that I will submit another PR for as they are not related to this immediate fix.
Fixes #430
Fixes fetch calls throwing outside of their calling try/catch #366