UNPKG

@nanggo/social-preview

Version:

Generate beautiful social media preview images from any URL

39 lines (38 loc) 1.17 kB
"use strict"; /** * Type definitions for Social Preview Generator */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PreviewGeneratorError = exports.ErrorType = void 0; /** * Error types */ var ErrorType; (function (ErrorType) { /** Failed to fetch URL */ ErrorType["FETCH_ERROR"] = "FETCH_ERROR"; /** Failed to extract metadata */ ErrorType["METADATA_ERROR"] = "METADATA_ERROR"; /** Failed to process image */ ErrorType["IMAGE_ERROR"] = "IMAGE_ERROR"; /** Template not found */ ErrorType["TEMPLATE_ERROR"] = "TEMPLATE_ERROR"; /** Invalid options provided */ ErrorType["VALIDATION_ERROR"] = "VALIDATION_ERROR"; /** Cache operation failed */ ErrorType["CACHE_ERROR"] = "CACHE_ERROR"; })(ErrorType || (exports.ErrorType = ErrorType = {})); /** * Custom error class for preview generation */ class PreviewGeneratorError extends Error { type; details; constructor(type, message, details) { super(message); this.name = 'PreviewGeneratorError'; this.type = type; this.details = details; } } exports.PreviewGeneratorError = PreviewGeneratorError;