UNPKG

@quasarbright/projection

Version:

A static site generator that creates a beautiful, interactive gallery to showcase your coding projects. Features search, filtering, tags, responsive design, and an admin UI.

44 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorCodes = exports.ProjectionError = void 0; /** * Custom error class for Projection-specific errors */ class ProjectionError extends Error { constructor(message, code, details = {}) { super(message); this.name = 'ProjectionError'; this.code = code; this.details = details; // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, ProjectionError); } } /** * Formats the error as a user-friendly message */ toUserMessage() { let message = `❌ Error: ${this.message}\n`; if (Object.keys(this.details).length > 0) { message += '\nDetails:\n'; for (const [key, value] of Object.entries(this.details)) { message += ` ${key}: ${value}\n`; } } return message; } } exports.ProjectionError = ProjectionError; /** * Error codes for different error categories */ exports.ErrorCodes = { VALIDATION_ERROR: 'VALIDATION_ERROR', CONFIG_ERROR: 'CONFIG_ERROR', FILE_NOT_FOUND: 'FILE_NOT_FOUND', FILE_WRITE_ERROR: 'FILE_WRITE_ERROR', PARSE_ERROR: 'PARSE_ERROR', RUNTIME_ERROR: 'RUNTIME_ERROR' }; //# sourceMappingURL=errors.js.map