From TypeScript@2.5, you can omit catch error block.

Before:

try {
throw new Error('whatever');
} catch(err) {
console.log(err)
}

Now:

try {
throw new Error('whatever');
} catch {
console.log("error happened")
}

It is just a syntax sugar, if you are not trying to do error handling

[TypeScript@2.5] Omit catch error block if not needed的更多相关文章

  1. [Angular] Observable.catch error handling in Angular

    import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/opera ...

  2. Uncaught Error: Script error for "popper.js", needed by: bootstrap - require.js

    Uncaught Error: Script error for "popper.js", needed by: bootstrap https://requirejs.org/d ...

  3. hdfs.server.datanode.DataNode: Block pool ID needed, but service not yet registered with NN

    启动hadoop 发现 50070 的 livenode 数量是 0 查看日志, hdfs.server.datanode.DataNode: Block pool ID needed, but se ...

  4. Vue使用Typescript开发编译时提示“ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'afterCompile' of undefined”的解决方法

    使用Typescript开发Vue,一切准备就绪.但npm start 时,提示“ ERROR in ./src/main.tsModule build failed: TypeError: Cann ...

  5. [Node] Catch error for async await

    When we try to do MongoDB opration, mongoose return Promise, we can use async/await to simply the co ...

  6. how to catch error in make error message

    make 2>&1 | grep error -C 10 -n

  7. Block pool ID needed, but service not yet registered with NN java.lang.Exception: trace 异常解决

    以上为报错信息: 原因大概为:dd和nd关联的versionId不同导致, 解决方案,备份之前的current文件夹,让其自己生成新的.

  8. [RxJS] Error handling operator: catch

    Most of the common RxJS operators are about transformation, combination or filtering, but this lesso ...

  9. catch socket error

    whois_handler.dart import 'dart:io'; import 'package:async/async.dart'; import 'dart:convert'; class ...

随机推荐

  1. cd---切换工作目录

    cd命令用来切换工作目录至dirname. 其中dirName表示法可为绝对路径或相对路径.若目录名称省略,则变换至使用者的home directory(也就是刚login时所在的目录).另外,~也表 ...

  2. linux 查看tomcat 实时日志

    进入tomcat下logs文件夹下,若没有Catalina.out文件先去启动服务在回到logs文件夹输入 tail -f catalina.out ,可看到实时日志

  3. 洛谷——P1155 双栈排序

    题目描述 Tom最近在研究一个有趣的排序问题.如图所示,通过2个栈S1和S2,Tom希望借助以下4种操作实现将输入序列升序排序. 操作a 如果输入序列不为空,将第一个元素压入栈S1 操作b 如果栈S1 ...

  4. [React] Stop Memory Leaks with componentWillUnmount Lifecycle Method in React

    In this lesson we'll take a stopwatch component we built in another lesson and identify and fix a me ...

  5. android 二次按返回键退出client

    android中有的app退出client时弹出对话框的方法,有的是点击二次,第一次是提示用户是否退出client,第二次点击才是真正的退出app.这是用二次点击返回键的时间间隔推断, 今天就实现这简 ...

  6. Linux Unix shell 编程指南学习笔记(第二部分)

    第七章  正則表達式介绍 匹配行首与行尾 匹配数据集 职匹配字母和数字 句点 "." 匹配随意单字符. ^,在行首 匹配字符串或字符序列,如查询当前文件夹下的全部文件夹: ls - ...

  7. HDU1796 How many integers can you find【容斥定理】

    题目链接: http://acm.hdu.edu.cn/showproblem.php? pid=1796 题目大意: 给你一个整数N.和M个整数的集合{A1.A2.-.Am}.集合内元素为非负数(包 ...

  8. Handle-postDelayed 延迟操作

    今天在工作的时候,遇到了一个方法,是关于Handle来实现延时操作的,自己写了一个小demo,学习总结如下 xml <?xml version="1.0" encoding= ...

  9. MathType下载和安装(与Visio搭配使用)

    不多说,直接上干货! 福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑          ...

  10. Codefroces Educational Round 27 (A,B,C,D)

    A. Chess Tourney time limit per test 1 second memory limit per test 256 megabytes input standard inp ...