Library API
    Preparing search index...

    Function asError

    • Coerces an unknown value into a proper Error instance. Preserves the name, message, stack, and code if available.

      Parameters

      • err: unknown

        The unknown error value

      Returns Error & { code?: string | number }

      An Error instance

      const err = asError('Something went wrong');