-
Notifications
You must be signed in to change notification settings - Fork 35
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
Uncatchable error from useUpdateItem #122
Comments
Thanks for the detailed issue @leffot! 🙌 I have debugged this and looks like it's related to this debounce
What's happening?
How to solve it?I would remove it from the library and let the users decide if they want a debounce or not. (cc @jivewise) |
Thanks for the quick reply @jorgemasta! That makes sense. I appreciate you looking into it. |
The latest beta release includes this fix. You can try it running Closing because it will be included in the next release. |
Thanks @jorgemasta. Works like a charm! |
Using
Issue
When a user tries to increment a product’s inventory beyond the maximum available, an error is thrown:
Uncaught (in promise) Error: An unexpected error ocurred with the Bigcommerce API
.Of course, we expect an error to be returned in this instance, since the user should not be able to add more inventory to their cart, as they’ve already hit the limit.
But what’s odd is that this error cannot be caught, which means we can’t pass the error along to the user.
Our Incrementer component looks something like this:
The call to
updateItem
is wrapped in atry...catch
, so conceivably the error should be caught. Is there some other approach we’re supposed to take here?And in fact it appears that
updateItem
doesn’t even return a promise, because if we try this:Then
res
is immediately logged asundefined
, and the error is thrown a few seconds later. Thoughts?The text was updated successfully, but these errors were encountered: