Pogues
Pogues copied to clipboard
Avoid usage of catch handler for Promises
At some places, we use the catch handler to process failure in asynchronous code, but we'd better use the then(onFulfilled, onRejected) signature for the then handler to avoid our Promise to swallow errors happening in the then handler. It can make debugging very confusing, since we can for example have:
- a
LOAD_SOMETHING_SUCCESSaction; - the app tries to re-render and something unexpected happened;
- a
LOAD_SOMETHING_FAILURE, but not necessarily an error in the console.
See for instance https://github.com/InseeFr/Pogues/blob/d28a7f67894479807f6b3d1c45b1b24883a556c4/src/js/actions/questionnaire.js#L111
Once again, i need your help @loichenninger in order to decide what to do with this issue 😆
@BulotF to check