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

Always reject the download promise with a downloadException #26

Merged
merged 2 commits into from
Apr 9, 2021
Merged

Always reject the download promise with a downloadException #26

merged 2 commits into from
Apr 9, 2021

Conversation

micthiesen
Copy link
Contributor

It is useful to always reject a promise with an Error (superclass of downloadException). Using an Error ensures you have access to stack traces which can help with debugging: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject#description

In our case, using an Error as the reject reason would help give Sentry
better error information: getsentry/sentry-javascript#2546 (comment)

Michael Thiesen added 2 commits April 6, 2021 14:49
It is useful to always reject a promise with an Error. Using an Error
ensures you have access to stack traces which can help with debugging:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject#description

In our case, using an Error as the reject reason would help give Sentry
better error information:
getsentry/sentry-javascript#2546 (comment)
@micthiesen
Copy link
Contributor Author

@AleeeKoi this would help my team debug some errors. Let me know if I've done anything wrong or if you'd like changes!

@micthiesen
Copy link
Contributor Author

Also I tested these changes in our project (various successful downloads and different types of failures, including: bad status codes, network errors, and timeouts) and it worked fine.

@AleeeKoi
Copy link
Owner

AleeeKoi commented Apr 7, 2021

Hi @micthiesen , you are right!
PR seem fine, I will merge it asap. :)
Thank you

@micthiesen
Copy link
Contributor Author

Thanks 🙂

@AleeeKoi AleeeKoi merged commit 43285db into AleeeKoi:master Apr 9, 2021
@AleeeKoi
Copy link
Owner

AleeeKoi commented Apr 9, 2021

Merged!

image

@micthiesen
Copy link
Contributor Author

Thank you! We'll update our app next week

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