UNPKG

@siva-sub/mcp-public-transport

Version:

A Model Context Protocol server for Singapore transport data with real-time information and routing

34 lines (33 loc) 1.03 kB
export class TransportError extends Error { code; statusCode; originalError; constructor(message, code, statusCode = 500, originalError) { super(message); this.code = code; this.statusCode = statusCode; this.originalError = originalError; this.name = 'TransportError'; if (originalError) { this.stack = originalError.stack; } } } export class ValidationError extends TransportError { constructor(message, originalError) { super(message, 'VALIDATION_ERROR', 400, originalError); this.name = 'ValidationError'; } } export class APIError extends TransportError { constructor(message, code, statusCode = 502, originalError) { super(message, code, statusCode, originalError); this.name = 'APIError'; } } export class RateLimitError extends TransportError { constructor(message = 'Rate limit exceeded') { super(message, 'RATE_LIMIT_ERROR', 429); this.name = 'RateLimitError'; } }