martyjs / marty

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

`this.fetch` in store swallows errors #238

Closed sporto closed 9 years ago

sporto commented 9 years ago

In my store I had something like

    fetchLibraries(keyword) {
        return this.fetch({
            id: keyword,
            locally: function () {
                ...
            },
            remotely: function () {
                return librariesQuery.fetchLibraries(keyword);
            }
        });
    }

But in my Query I had:

  getLibraries(keyword) {
     ...

So getLibraries as opposed to fetchLibraries.

Browser shows no errors at all, the failed callback on createContainer gets called. But this is far from desired. Optimally only errors coming from actual fetch later on should be catched.

sporto commented 9 years ago

So in https://github.com/jhollingworth/marty/blob/f780507049ca93ceafdb2b13aa0f6164673b255a/dist/node/lib/store/fetch.js#L85 and https://github.com/jhollingworth/marty/blob/f780507049ca93ceafdb2b13aa0f6164673b255a/dist/node/lib/store/fetch.js#L85

Can this be changed so you only catch specific kind of errors? Let everything else bubble up?

jhollingworth commented 9 years ago

Completely agree with you. Thats a hangover from v0.8 where we attempted to handle errors for you. Will remove it