定义异常类型

异常处理

class SimpleException { }

class RecommendExc extends Error {
    constructor(msg: string) {
        super(msg);

        // 显式设置原型。
        Object.setPrototypeOf(this, 
            RecommendExc.prototype)
    }
}

throw new RecommendExc("exeption")