The Promise.err function needs its own active reject (Promise. The default return is resolve to the next level.)

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)

what result do you expect? What is the error message actually seen?

Jul.06,2021

That's what the

rule is. Don't use return ah, just throw .

you put this sentence:

return Promise.reject(err);

change it to:

throw err;

would be fine.

Menu