You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by @liadyreflux/refluxjs#403 Moved to here since promises have been extracted out of reflux-core and is now in reflux-promise.
Lately I started getting Uncaught (in promise) some-error errors in my console whenever an action failed.
I researched a bit and found out that Reflux creates a promise every time an action is triggered, and if the action fails, the promise rejects and there is no one to catch it. I boiled it down to:
// create an action with completed/failed childrenvaraction=Reflux.createAction({asyncResult:true});// *** First scenario - throws error *** //// invoke the actionaction();// somewhere the action has failedaction.failed("some reason");// throws an error in the console - why??// *** Second scenario - ok *** //// invoke the action, but with a catch clauseaction().catch(function(){});// somewhere the action has failedaction.failed("some reason 2");// this is now ok...
Seems like every action trigger creates a promise, and that causes this issue when the action fails. I would imagine this would happen only when calling action.triggerPromise explicitly, and not every time.
Currently I have to attach a catch clause to every action trigger in my code to fix this problem. I want my components to just call the actions, not handle their outcome. Is there a way to avoid it? Am I missing something here?
The text was updated successfully, but these errors were encountered:
This added catch in the merge had me hunting issues for days... all and any javascript errors (typos, even a throw new Error('error'); within a react render() method that was updated as a result of an async store trigger were being completely swallowed by this line. even adding unhandled error catch was obviously failing.
I think it's GOOD that unhandled errors are reported. swallowing them should be explicitly required by the developer.
Originally posted by @liady reflux/refluxjs#403 Moved to here since promises have been extracted out of reflux-core and is now in reflux-promise.
The text was updated successfully, but these errors were encountered: