martyjs / marty

A Javascript library for state management in React applications
http://martyjs.org
MIT License
1.09k stars 77 forks source link

Return error in locally #368

Closed jaulz closed 8 years ago

jaulz commented 8 years ago

Is it possible to return a custom error in locally? Thanks :)

taion commented 8 years ago

You can return whatever you want in locally.

jaulz commented 8 years ago

But this would not trigger the failed callback. Basically my remotely returns a promise which is rejected with the actual error object but as my locally is called afterwards the error is forgotten. Any idea how to reflect this?

taion commented 8 years ago

Your locally needs to not return a valid value for the failure handling to work. Alternatively, you can return a sentinel value in locally that your component can render appropriately into an error.

jaulz commented 8 years ago

I don't want to handle the error in the component itself but instead it should be automatically handled in the container. This is nothing which one can do today if I understand the code correctly. Should this be a feature request?

taion commented 8 years ago

Just throw in your locally.