export class AppError extends Error { constructor(message, status = 500, code = "INTERNAL_ERROR", details = null) { super(message); this.name = "AppError"; this.status = status; this.code = code; this.details = details; } } export function assertFound(value, message = "Resource not found") { if (!value) { throw new AppError(message, 404, "NOT_FOUND"); } return value; }