MCPcopy Create free account
hub / github.com/WhiteSevs/TamperMonkeyScript / executeTryCatch

Function executeTryCatch

lib/Utils/src/TryCatch.ts:55–83  ·  view source on GitHub ↗

* 执行传入的函数并捕获其可能抛出的错误,并通过传入的错误处理函数进行处理。 * @param callback - 待执行函数,可以是 function 或者 string 类型。如果是 string 类型,则会被当做代码进行执行。 * @param handleErrorFunc - 错误处理函数,可以是 function 或者 string 类型。如果是 string 类型,则会被当做代码进行执行。 * @param funcThis - 待执行函数的作用域,用于apply指定 * @returns 如果函数有返回值,则返回该返回值;否则返回 undefined。

(
    callback: string | ((...args: A) => R) | ((...args: any[]) => any),
    handleErrorFunc: string | ((...args: any[]) => any),
    funcThis?: any
  )

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

runFunction · 0.85

Calls 2

applyMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected