Provides functions for crafting errors and transmuters with specified module and context.

  • Parameters

    • module: string

      The module name to use for crafted errors.

    • context: string

      The context to use for crafted errors.

    Returns {
        craftErrorLogger: ((props: CraftErrorLoggerProps) => ((err: unknown) => void));
        craftErrorResolver: ((props: CraftErrorResolverProps) => ((err: unknown) => void));
        craftErrorResolverMap: ((...mapping: ErrorMapEntry[]) => Map<typeof SynthesizedError, ((err: SynthesizedError) => void)>);
        craftErrorSynthesizer: ((middlewareChain: SynthesizerMiddlewareChain) => Synthesizer);
        craftErrorTransmuter: (<T>(detectorFunction: DetectorFunction, transmuterFunction: TransmuterFunction<T>) => Transmuter<T>);
        craftMysticError: ((props: {
            cause?: string;
            errorCode?: ErrorCode;
            name: string;
            severity?: Severity;
        }) => typeof CraftedMysticError);
        craftSynthesizedError: ((props: {
            cause?: string;
            errorCode?: ErrorCode;
            name: string;
            severity?: Severity;
        }) => typeof CraftedSynthesizedError);
    }

    An object containing functions for crafting errors and transmuters.

    • craftErrorLogger: ((props: CraftErrorLoggerProps) => ((err: unknown) => void))

      Crafts a new error logger with the given properties.

      The properties of the error logger.

      The crafted error logger function.

        • (props): ((err: unknown) => void)
        • Crafts a new error logger with the given logger properties.

          Parameters

          Returns ((err: unknown) => void)

          The crafted error logger function.

            • (err): void
            • Parameters

              • err: unknown

              Returns void

    • craftErrorResolver: ((props: CraftErrorResolverProps) => ((err: unknown) => void))

      Crafts a new error resolver with the given properties.

      The properties of the error resolver.

      The crafted error resolver function.

        • (props): ((err: unknown) => void)
        • Crafts a new error resolver with the given properties.

          Parameters

          Returns ((err: unknown) => void)

          The crafted error resolver function.

            • (err): void
            • Parameters

              • err: unknown

              Returns void

    • craftErrorResolverMap: ((...mapping: ErrorMapEntry[]) => Map<typeof SynthesizedError, ((err: SynthesizedError) => void)>)

      Crafts a new error resolver map with the given mappings.

      The error map entries.

      The crafted error resolver map.

    • craftErrorSynthesizer: ((middlewareChain: SynthesizerMiddlewareChain) => Synthesizer)

      Crafts a new error synthesizer with the given middleware chain.

      The middleware chain of transmuters.

      The crafted synthesizer.

        • (middlewareChain): Synthesizer
        • Crafts a new error synthesizer with the given middleware chain, injecting module and context.

          Parameters

          Returns Synthesizer

          The crafted synthesizer.

    • craftErrorTransmuter: (<T>(detectorFunction: DetectorFunction, transmuterFunction: TransmuterFunction<T>) => Transmuter<T>)

      Crafts a new transmuter with the given detector and transmuter functions.

      The function to detect errors.

      The function to transmute errors.

      The crafted transmuter.

        • <T>(detectorFunction, transmuterFunction): Transmuter<T>
        • Crafts a new transmuter with the given detector and transmuter functions, injecting module and context.

          Type Parameters

          • T = any

          Parameters

          Returns Transmuter<T>

          The crafted transmuter.

    • craftMysticError: ((props: {
          cause?: string;
          errorCode?: ErrorCode;
          name: string;
          severity?: Severity;
      }) => typeof CraftedMysticError)

      Crafts a new mystic error with the given properties.

      The properties of the mystic error.

      The crafted mystic error.

        • (props): typeof CraftedMysticError
        • Crafts a new mystic error with the given properties, injecting module and context.

          Parameters

          • props: {
                cause?: string;
                errorCode?: ErrorCode;
                name: string;
                severity?: Severity;
            }

            The properties of the mystic error.

            • Optionalcause?: string
            • OptionalerrorCode?: ErrorCode
            • name: string
            • Optionalseverity?: Severity

          Returns typeof CraftedMysticError

          The crafted mystic error.

    • craftSynthesizedError: ((props: {
          cause?: string;
          errorCode?: ErrorCode;
          name: string;
          severity?: Severity;
      }) => typeof CraftedSynthesizedError)

      Crafts a new synthesized error with the given properties.

      The properties of the synthesized error.

      The crafted synthesized error.

        • (props): typeof CraftedSynthesizedError
        • Crafts a new synthesized error with the given properties, injecting module and context.

          Parameters

          • props: {
                cause?: string;
                errorCode?: ErrorCode;
                name: string;
                severity?: Severity;
            }

            The properties of the synthesized error.

            • Optionalcause?: string
            • OptionalerrorCode?: ErrorCode
            • name: string
            • Optionalseverity?: Severity

          Returns typeof CraftedSynthesizedError

          The crafted synthesized error.