Skip to content

Commit

Permalink
Merge pull request #515 from quicksnap/master
Browse files Browse the repository at this point in the history
Document error handling of transitionMiddleware
  • Loading branch information
erikras committed Nov 10, 2015
2 parents 943f322 + a8e3131 commit eba5ffe
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/redux/middleware/transitionMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ export default ({getState, dispatch}) => next => action => {
const doTransition = () => {
next(action);
Promise.all(getDataDependencies(components, getState, dispatch, location, params, true))
.then(resolve, resolve);
.then(resolve)
.catch(error => {
// TODO: You may want to handle errors for fetchDataDeferred here
console.warn('Warning: Error in fetchDataDeferred', error);
return resolve();
});
};

Promise.all(getDataDependencies(components, getState, dispatch, location, params))
.then(doTransition, doTransition);
.then(doTransition)
.catch(error => {
// TODO: You may want to handle errors for fetchData here
console.warn('Warning: Error in fetchData', error);
return doTransition();
});
});

if (__SERVER__) {
Expand Down

0 comments on commit eba5ffe

Please sign in to comment.