@chickenjdk/common
    Preparing search index...

    Function errorFuncWrap

    • Wrap error-generating functions to change the type of error that it throws and optionally prepend its message

      Type Parameters

      • assertFunc extends [(...args: any[]) => any]

        The assertion function to wrap. It should throw an error if the assertion fails.

      Parameters

      • assertFunc: assertFunc[0]
      • customError: new (message: string) => any = Error

        The custom error class to throw instead of the original error. Defaults to Error.

      • prependErrorWith: string = ""

        Text to prepend to the error message. Defaults to an empty string.

      Returns assertFunc[0]

      A wrapped version of the assertFunc that throws the customError with the prepended message.