Skip to content

Commit eba5ffe

Browse files
committed
Merge pull request #515 from quicksnap/master
Document error handling of transitionMiddleware
2 parents 943f322 + a8e3131 commit eba5ffe

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/redux/middleware/transitionMiddleware.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ export default ({getState, dispatch}) => next => action => {
1515
const doTransition = () => {
1616
next(action);
1717
Promise.all(getDataDependencies(components, getState, dispatch, location, params, true))
18-
.then(resolve, resolve);
18+
.then(resolve)
19+
.catch(error => {
20+
// TODO: You may want to handle errors for fetchDataDeferred here
21+
console.warn('Warning: Error in fetchDataDeferred', error);
22+
return resolve();
23+
});
1924
};
2025

2126
Promise.all(getDataDependencies(components, getState, dispatch, location, params))
22-
.then(doTransition, doTransition);
27+
.then(doTransition)
28+
.catch(error => {
29+
// TODO: You may want to handle errors for fetchData here
30+
console.warn('Warning: Error in fetchData', error);
31+
return doTransition();
32+
});
2333
});
2434

2535
if (__SERVER__) {

0 commit comments

Comments
 (0)