格式
typescript
Exception.name所属类: Exception
描述
指定的异常类型名字,用于区分抛出的异常是否是指定的异常类型。
参数
| 参数名 | 类型 | 描述 |
|---|
返回值
| 类型 | 描述 |
|---|---|
string | 异常类型名 |
代码示例
javascript
function Test() {
try {
throw new Exception("Exception test.");
} catch (error) {
Debug.log(error);
let exp = error as Exception;
if (exp.name != Exception.name) {
Debug.log("Is a 'Exception' type error");
}
}
}