-
Notifications
You must be signed in to change notification settings - Fork 199
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
Added catch block to failed API calls #296
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! |
@jywarren @Rishabh570 please review |
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.
Hi @somenath1435, yes this file might be the origin of the bug but we need to propagate the error to the main file, so you need to throw err
here instead of logging it. Also, for that, the whole structure of this function will change...as the functions are themselves async you can remove the return new Promise...
wrapper and in the "if & else" you can do then & catch
instead. I hope I helped.
Thanks!!!
@Rishabh570 I've logged the error as well as thrown the error in the current PR |
@Rishabh570 please suggest |
@Rishabh570 any suggestions?? |
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.
I guess this won't be the right way to throw an error, resolve()
will receive the error object. We need to have the functions have the catch callback instead of return Promise...
fixes #284
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
fixes #0000
-style reference to original issue #@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.
Thanks!