@spaik/mcp-server-roi
Version:
MCP server for AI ROI prediction and tracking with Monte Carlo simulations
86 lines • 2.39 kB
TypeScript
/**
* Custom error types for MCP Server ROI
*/
export declare abstract class BaseError extends Error {
readonly code: string;
readonly statusCode: number;
readonly isOperational: boolean;
readonly context?: Record<string, any>;
constructor(message: string, code: string, statusCode: number, isOperational?: boolean, context?: Record<string, any>);
}
/**
* Validation errors for input data
*/
export declare class ValidationError extends BaseError {
constructor(message: string, context?: Record<string, any>);
}
/**
* Database-related errors
*/
export declare class DatabaseError extends BaseError {
constructor(message: string, context?: Record<string, any>);
}
/**
* Worker thread errors
*/
export declare class WorkerError extends BaseError {
constructor(message: string, context?: Record<string, any>);
}
/**
* Calculation errors (e.g., IRR convergence failure)
*/
export declare class CalculationError extends BaseError {
constructor(message: string, context?: Record<string, any>);
}
/**
* Configuration errors
*/
export declare class ConfigurationError extends BaseError {
constructor(message: string, context?: Record<string, any>);
}
/**
* Resource not found errors
*/
export declare class NotFoundError extends BaseError {
constructor(resource: string, identifier: string | number);
}
/**
* Rate limiting errors
*/
export declare class RateLimitError extends BaseError {
constructor(limit: number, window: string);
}
/**
* Timeout errors
*/
export declare class TimeoutError extends BaseError {
constructor(operation: string, timeoutMs: number);
}
/**
* Input validation specific errors
*/
export declare class InputValidationError extends ValidationError {
constructor(field: string, value: any, reason: string);
}
/**
* Range validation errors
*/
export declare class RangeError extends ValidationError {
constructor(field: string, value: number, min?: number, max?: number);
}
/**
* Type guard to check if an error is operational
*/
export declare function isOperationalError(error: Error): error is BaseError;
/**
* Error serializer for API responses
*/
export declare function serializeError(error: Error): {
name: string;
message: string;
code?: string;
statusCode?: number;
context?: Record<string, any>;
stack?: string;
};
//# sourceMappingURL=errors.d.ts.map