<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
// 结论
// 1.错误不会被重复铺获;
// 2.catch返回一个promise实例,并且 是resolve的状态
console.log("here we go...");
new Promise(resolve => {
setTimeout(()=>{
resolve();
},2000)
})
.then(()=>{
console.log("start");
throw new Error ("test error")
})
.catch(err=>{
console.log("I catch:",err)
})
.then(()=>{
console.log("arrive here!");
})
.then(()=>{
console.log("here...")
})
.catch(err=>{
console.log("No ,I Catch:",err)
})
</script>
</body>
</html>
网友评论