<分区>
我正在使用一个 npm 模块,它在错误时抛出一个空函数,即 UnauthorizedException
。我希望能够识别抛出的函数,以便我可以相应地处理它
function UnauthorizedException() {
}
const f = () => {
throw (new UnauthorizedException());
};
try {
f();
} catch (err) {
// How to identity a function name/property/etc so I can handle the error accordingly
console.log(err);
console.log(typeof (err));
}