ara icon indicating copy to clipboard operation
ara copied to clipboard

Handle errors on API calls

Open omar-chahbouni-decathlon opened this issue 4 years ago • 0 comments

What it's the actual situation on ARA ? Every time an API is called, a function that handle the error is also called (api.handleError(error)). Although this works, there are a few disadvantages:

  • This is extra work
  • This is redundant code
  • If a new behavior is required, you need to update all the api calls
  • You can forget to add it
  • It is not a good practice

Describe the solution you'd like An interceptor is a good solution.

IMPORTANT: Don't forget to delete all the function (api.handleError(error)) calls when catching the error