当前位置:网站首页>Es6--- two methods of capturing promise status as failed
Es6--- two methods of capturing promise status as failed
2022-07-06 15:27:00 【Cirrod】
1.try cath Method
async fn() {
try {
await promise object
} catch (err) {
console.log(err)// Capture failed promise
}
}
2. adopt promise The built-in .catch() Method
async fn() {
await promise object .catch(err => {
console.log(err)// Capture failed promise
})
}
边栏推荐
- Stc-b learning board buzzer plays music 2.0
- Jupyter installation and use tutorial
- Sorting odd and even subscripts respectively for leetcode simple problem
- Eslint--- error: newline required at end of file but not found (EOL last) solution
- The most detailed postman interface test tutorial in the whole network. An article meets your needs
- FSM和i2c实验报告
- 软件测试面试要问的性能测试术语你知道吗?
- JS --- detailed explanation of JS facing objects (VI)
- Visual analysis of data related to crawling cat's eye essays "sadness flows upstream into a river" | the most moving film of Guo Jingming's five years
- Mysql database (IV) transactions and functions
猜你喜欢
Stm32 dossiers d'apprentissage: saisie des applications
LeetCode#62. Different paths
Want to change jobs? Do you know the seven skills you need to master in the interview software test
Rearrange spaces between words in leetcode simple questions
软件测试有哪些常用的SQL语句?
ucore lab7 同步互斥 实验报告
What if software testing is too busy to study?
Winter vacation daily question - maximum number of balloons
Stc-b learning board buzzer plays music
ucore lab8 文件系统 实验报告
随机推荐
LeetCode#204. Count prime
The minimum sum of the last four digits of the split digit of leetcode simple problem
学习记录:使用STM32F1看门狗
LeetCode#2062. Count vowel substrings in strings
LeetCode#412. Fizz Buzz
ucore lab6 调度器 实验报告
Your wechat nickname may be betraying you
LeetCode#198. raid homes and plunder houses
Contest3145 - the 37th game of 2021 freshman individual training match_ A: Prizes
Stm32 dossiers d'apprentissage: saisie des applications
What to do when programmers don't modify bugs? I teach you
Which version of MySQL does php7 work best with?
The latest query tracks the express logistics and analyzes the method of delivery timeliness
csapp shell lab
Daily code 300 lines learning notes day 9
csapp shell lab
C4D quick start tutorial - creating models
Mysql database (III) advanced data query statement
遇到程序员不修改bug时怎么办?我教你
The wechat red envelope cover designed by the object is free! 16888