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

Reflux actions throw an error in the console when they fail #403

Closed
liady opened this issue Aug 21, 2015 · 4 comments
Closed

Reflux actions throw an error in the console when they fail #403

liady opened this issue Aug 21, 2015 · 4 comments
Labels

Comments

@liady
Copy link

liady commented Aug 21, 2015

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 children
var action = Reflux.createAction({asyncResult:true});

// *** First scenario - throws error *** //
// invoke the action
action();
// somewhere the action has failed
action.failed("some reason"); // throws an error in the console - why??


// *** Second scenario - ok *** //
// invoke the action, but with a catch clause
action().catch(function(){});
// somewhere the action has failed
action.failed("some reason 2"); // this is now ok...

Fiddle here

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?

@liady liady changed the title Reflux actions throws an error in the console when they fail Reflux actions throw an error in the console when they fail Aug 23, 2015
@jfairley
Copy link

jfairley commented Sep 8, 2015

👍

I would like to see this resolved as well. If a developer wants to log an error, he can do so with an onActionFailed function. IMO, reflux should remain silent.

@CrisLi
Copy link

CrisLi commented Sep 29, 2015

+1

@CrisLi
Copy link

CrisLi commented Oct 8, 2015

Is there any plan which release will have this bug fixing?

@spoike
Copy link
Member

spoike commented Oct 13, 2015

Since reflux-core (and by extension reflux) has had it's promise extensions extracted to reflux-promise. I've moved the issue there: reflux/reflux-promise#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants