当前位置:网站首页>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
})
}
边栏推荐
- Sorting odd and even subscripts respectively for leetcode simple problem
- Example 071 simulates a vending machine, designs a program of the vending machine, runs the program, prompts the user, enters the options to be selected, and prompts the selected content after the use
- 学习记录:如何进行PWM 输出
- MySQL数据库(五)视 图 、 存 储 过 程 和 触 发 器
- STM32 learning record: input capture application
- Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]
- 51 lines of code, self-made TX to MySQL software!
- C4D quick start tutorial - creating models
- The minimum sum of the last four digits of the split digit of leetcode simple problem
- LeetCode#412. Fizz Buzz
猜你喜欢
MySQL development - advanced query - take a good look at how it suits you
Crawler series of learning while tapping (3): URL de duplication strategy and Implementation
CSAPP Shell Lab 实验报告
学习记录:使用STM32外部输入中断
What to do when programmers don't modify bugs? I teach you
全网最详细的postman接口测试教程,一篇文章满足你
Interface test interview questions and reference answers, easy to grasp the interviewer
ucore lab5
遇到程序员不修改bug时怎么办?我教你
Knowledge that you need to know when changing to software testing
随机推荐
JS --- JS function and scope (II)
软件测试工作太忙没时间学习怎么办?
Leetcode simple question: check whether two strings are almost equal
Currently, mysql5.6 is used. Which version would you like to upgrade to?
接口测试面试题及参考答案,轻松拿捏面试官
In Oracle, start with connect by prior recursive query is used to query multi-level subordinate employees.
Rearrange spaces between words in leetcode simple questions
線程及線程池
Investment operation steps
Sorting odd and even subscripts respectively for leetcode simple problem
基于485总线的评分系统
Collection集合与Map集合
MySQL数据库(一)
STM32 learning record: input capture application
ucore Lab 1 系统软件启动过程
Lab 8 file system
How to become a good software tester? A secret that most people don't know
ucorelab4
[pytorch] simple use of interpolate
Introduction to safety testing