seems we prefer to use catch to handle the exception since the reject function may miss some errors, e.g. in below code the error a is not defined will not be cached.
const promise = new Promise((resolve,reject) => {
console.log(1)
resolve('successfully')
})
promise
.then((data) => {
console.log(data)
console.log(a)
}, (err) => {
console.log(err)
})
we prefer to use catch method to catch the errors like below:
promise
.then((data) => {
console.log(data)
console.log(a)
}).catch(err => {
console.log(err);
})
My question is: are there any solutions that need to use reject and catch method at the same time?