UNPKG

@ocubist/error-alchemy

Version:

A powerful Node.js error-handling-framework with custom error types for easy debugging, enhanced error management, strong zod-support and useful quality-of-life-functionality for asserting and validating values.

19 lines (15 loc) 621 B
import { SynthesizedError } from "../../transmuted-errors/SynthesizedError"; type ErrorMapEntry = [typeof SynthesizedError, (err: SynthesizedError) => void]; /** * Crafts a new error resolver map with the given mappings. * * @param {...ErrorMapEntry[]} mapping - The error map entries. * @returns {Map<typeof SynthesizedError, (err: SynthesizedError) => void>} The crafted error resolver map. */ export const craftErrorResolverMap = (...mapping: ErrorMapEntry[]) => { const errorResolverMap = new Map< typeof SynthesizedError, (err: SynthesizedError) => void >(mapping); return errorResolverMap; };