Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 7x 3x 3x 1x 1x 1x | import { voidFun } from '../common/constant'
/**
* 原生try函数
* ../param fn try中执行的函数体
* ../param errorFn 报错时执行的函数体,将err传入
*/
export function nativeTryCatch(fn: voidFun, errorFn?: (err: any) => void): void {
try {
fn()
} catch (err) {
console.log('err', err)
Eif (errorFn) {
errorFn(err)
}
}
}
|