@chickenjdk/common
    Preparing search index...

    Function createClassifyedError

    • Create a classified error class that extends the oldError to add fancy classification prepended text and adds the reasonChain and isFatal properties.

      Type Parameters

      • reason extends string

        The error reason

      • isFatal extends boolean = true

        If the error is fatal. Defaults to true.

      • oldError extends new (...args: [message?: string]) => InstanceType<oldError> = ErrorConstructor

        The old error class to extend. Defaults to Error.

      Parameters

      Returns NoFunc<oldError> & new (
          ...args: ConstructorParameters<oldError>,
      ) => Omit<InstanceType<oldError>, "isFatal"> & {
          isFatal: isFatal;
          reasonChain: string[];
      }

      The new error class that extends the oldError with the reasonChain and isFatal properties.