UNPKG

@common-grants/cli

Version:
24 lines (23 loc) 876 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleCommandError = handleCommandError; const zod_1 = require("zod"); const chalk_1 = __importDefault(require("chalk")); function handleCommandError(error) { if (error instanceof zod_1.ZodError) { console.error(chalk_1.default.red("Validation error:")); error.issues.forEach(err => { console.error(chalk_1.default.red(`- ${err.path.join(".")}: ${err.message}`)); }); } else if (error instanceof Error) { console.error(chalk_1.default.red("Error:"), error.message); } else { console.error(chalk_1.default.red("An unexpected error occurred:"), error); } process.exit(1); }