Friday, 25 January 2019

promise then onrejected vs catch



https://www.kancloud.cn/kancloud/promises-book/44255

someRestAPICall.then((value)=>{
   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