UNPKG

@devabdultech/hn-mcp-server

Version:

MCP Server for using the Hacker News API

23 lines 771 B
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js"; export class NotFoundError extends McpError { constructor(resource, id) { super(ErrorCode.InvalidParams, `${resource} with ID ${id} not found`); } } export class ValidationError extends McpError { constructor(message) { super(ErrorCode.InvalidParams, `Validation error: ${message}`); } } export class ApiError extends McpError { constructor(api, message) { super(ErrorCode.InternalError, `${api} API error: ${message}`); } } export function handleApiError(error, api) { if (error instanceof Error) { throw new ApiError(api, error.message); } throw new ApiError(api, "Unknown error occurred"); } //# sourceMappingURL=errors.js.map