@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.
12 lines (10 loc) • 341 B
text/typescript
import { ErrorCode } from "./types";
/**
* Checks if a given string is a valid error code.
*
* @param {string} errorCode - The error code to check.
* @returns {boolean} True if the error code is valid, false otherwise.
*/
export const isErrorCode = (errorCode: string): boolean => {
return ErrorCode.safeParse(errorCode).success;
};