Friday, 25 January 2019

promise then onrejected vs catch

   good call back .  position OK
}, error =>{
   handle error here .------ position A
}).catch(error =>{
    also can handle here. ----- position B

The best place to handle the error is position B!!! because it also catch error from position OK.  but handler in position A can only handle errors of your "someRestAPICall"

No comments:

Post a comment