Function tryCatchWrapSync

  • Wraps a synchronous function with error handling logic.

    Type Parameters

    • R

    • T extends ((...args) => R)

    Parameters

    • func: T

      The function to wrap.

    • Optional onError: ((error) => void)
        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns ((this, ...args) => void | R)

    A new function that wraps the original function with error handling.

      • (this, ...args): void | R
      • Parameters

        • this: unknown
        • Rest ...args: Parameters<T>

        Returns void | R

Generated using TypeDoc