Refactor the error handler for fetch API calls
Closed this issue · 1 comments
TheYuriG commented
After completing issue #1, we will have an issue with the default error handler we use in our functions.
Our error handlers will need to be updated accordingly and refactored. We currently check twice for resData.errors
which is wasted computational power, considering that if the first if
check succeded, we would throw an error and the second wouldn't run regardless.
Refactor the code to only check for resData.errors
once and then safely check resData.errors[0].status
using the safe call operator .?
.