the return of err and catch does not default to reject.
new Promise((resolve, reject) => {
setTimeout(() => {
if (0) {
resolve(10)
} else {
reject(11)
}
}, 0)
}).then(data => {
if (0) {
return Promise.resolve(data + "20")
} else {
return Promise.reject(data + "21")
}
}, err => {
//err reject Promise return resolve )
return Promise.reject(err);
})
.then(data => {
console.log(data)
}, err => {
console.log(err)
})
sources of topics and their own ideas
related codes
/ / Please paste the code text below (do not replace the code with pictures)
what result do you expect? What is the error message actually seen?
problem description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)