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

Simplify error handling #163

Closed
jhollingworth opened this issue Mar 6, 2015 · 3 comments
Closed

Simplify error handling #163

jhollingworth opened this issue Mar 6, 2015 · 3 comments
Milestone

Comments

@jhollingworth
Copy link
Contributor

How action creators work, in particular error handling is a recurring issue (#157, #152, #127) we need to solve. Having the action creators automatically dispatch ACTION_{type} errors seemed like a neat idea at the time but it's not very useful and has lead to a load of complicated code and crappy APIs.

I think we should just go back to a simpler, explicit approach (Yahoo has some good examples):

  • No more dispatching ACTION_{type} errors
  • Don't wrap action creator functions in promises
  • Explicit error handling
var FooActionCreators = Marty.createActionCreators({
  createFoo(foo) {
    this.dispatch(Constants.RECIEVE_FOO, foo);

    FooAPI.createFoo(foo).catch((error) => {
      this.dispatch(Constants.RECIEVE_FOO_FAILED, foo, error);
    });
  }  
});

As much as I'd like to have some automatic error handling/retrying I think we should get the simple case right first.

@jhollingworth jhollingworth added this to the 0.9 milestone Mar 6, 2015
@jhollingworth
Copy link
Contributor Author

@oliverwoodings @dariocravero @giuse88 what do you think?

This was referenced Mar 6, 2015
@dariocravero
Copy link
Contributor

👍 for a simplified approach. Clean stack traces are vital and even though we have some tracing right now the confusion it creates as to what actually originated the exception is enough to rethink what Marty is doing here.
Eventually the automated functionality could be provided through some syntactic sugar at some stage?

This was referenced Mar 6, 2015
@jhollingworth
Copy link
Contributor Author

#166 should resolve this

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

No branches or pull requests

2 participants