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

Added catch block to failed API calls #296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Added catch block to failed API calls #296

wants to merge 1 commit into from

Conversation

somenath1435
Copy link
Contributor

fixes #284
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • PR body includes fixes #0000-style reference to original issue #
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If 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!

@welcome
Copy link

welcome bot commented Dec 5, 2019

Thanks for opening this pull request! Dangerbot will test out your code and reply in a bit with some pointers and requests.
There may be some errors, but don't worry! We're here to help! 👍🎉😄

@somenath1435
Copy link
Contributor Author

@jywarren @Rishabh570 please review

Copy link
Collaborator

@Rishabh570 Rishabh570 left a 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!!!

@somenath1435
Copy link
Contributor Author

@Rishabh570 I've logged the error as well as thrown the error in the current PR

@somenath1435
Copy link
Contributor Author

@Rishabh570 please suggest

@somenath1435
Copy link
Contributor Author

@Rishabh570 any suggestions??

Copy link
Collaborator

@Rishabh570 Rishabh570 left a 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...

@jywarren jywarren changed the title Added catch block to fix an issue 284 Added catch block to failed API calls Oct 8, 2021
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.

Contributors list stalling due to rate limiting (need helpful error message)
3 participants