我的 Typescript 代码如下所示:
myFunction = async (param: string) : Promise<string, null> => {
//some synchronous code here
try {
await anotherAsyncFnWhichisThrowingAnException();
}
catch(err) {
//this code is not reached even on an exception
}
}
即使当 anotherAsyncFnWhichisThrowingAnException 抛出异常时,catch 块中的代码也不会被执行。为什么会这样,我怎样才能捕捉到这个异常?