Skip to content

格式

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");
        }
    }
}