Pogues icon indicating copy to clipboard operation
Pogues copied to clipboard

Avoid usage of catch handler for Promises

Open ghost opened this issue 8 years ago • 2 comments

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_SUCCESS action;
  • 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

ghost avatar Feb 01 '17 09:02 ghost

Once again, i need your help @loichenninger in order to decide what to do with this issue 😆

romaintailhurat avatar Feb 16 '22 09:02 romaintailhurat

@BulotF to check

romaintailhurat avatar Mar 21 '23 10:03 romaintailhurat