SOURCE

let p = new Promise(function(resolve,reject){
    resolve('ok');
});
p.then(res => {
    return Promise.reject('fail');
});
p.then(res =>{
    console.log(res);
});
p.catch(res=>{
    console.log(res);
});

new Promise(function(resolve,reject){
    resolve('ok');
}).then(res => {
    return Promise.reject('fail');
}).then(res =>{
    console.log("chain:"+res);
}).catch(res=>{
    console.log("chain:"+res);
});
console 命令行工具 X clear

                    
>
console