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

fix: improve error handling #4

Merged
merged 13 commits into from
May 6, 2024
Merged

fix: improve error handling #4

merged 13 commits into from
May 6, 2024

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented May 3, 2024

Fun story; I was not aware that you were working on this, @j33ty - just as I was opening this PR I noticed #3
Feel free to either ignore this PR, or pick parts of it - up to you.

I started out wanting to fix an issue where certain errors seem to silently be swallowed. I believe some of those stem from the fact that any errors thrown in the promise constructor body is lost. The relevant fix for that is in e981a92. The change might look big, but it's really just about using a deferred promise (eg what is today Promise.withResolvers()) and lifting the logic up one scope, thus the large diff.

While doing this change and adding tests, I realized that there were other problems, so I attempted to fix those as well:

  • 253229e makes it easier to see what is actually going on when aggregate errors are reported while debugging
  • 3b601fe makes errors more descriptive, eg instead of 500: Internal Server Error it would print something like Export: HTTP 500: Internal Server Error: Some descriptive message from the backend
  • 6e8cd12 fixes an issue where client errors such as invalid tokens would be retried 10 times - 4xx errors doesn't really make sense to retry
  • 927c958 fixes an issue where asset download errors would always say Failed to parse error response from asset stream, even when that wasn't the case

@rexxars rexxars requested a review from j33ty May 3, 2024 10:44
Copy link
Contributor

@j33ty j33ty left a comment

Choose a reason for hiding this comment

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

Looks good to me. Left some minor comments.

Let's merge this one and then I can rebase it on top of my changes.

src/requestStream.js Outdated Show resolved Hide resolved
src/validateOptions.js Outdated Show resolved Hide resolved
src/requestStream.js Outdated Show resolved Hide resolved
src/AssetHandler.js Outdated Show resolved Hide resolved
@j33ty j33ty merged commit cde1ab7 into main May 6, 2024
3 checks passed
@j33ty j33ty mentioned this pull request May 6, 2024
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.

2 participants