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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bee714-3144c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bee714-3144c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?