@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
52 lines • 1.82 kB
TypeScript
/**
* Base error class for application
* All custom errors should extend this class or its subclasses
*/
export declare abstract class BaseError extends Error {
readonly code: string;
readonly details?: Record<string, unknown> | undefined;
/**
* Error creation timestamp
*/
readonly timestamp: Date;
/**
* Original error that caused this error (if any)
*/
readonly cause?: Error;
/**
* Create a new BaseError
*
* @param code Unique error code for identification and documentation
* @param message Human-readable error message
* @param details Additional error details for debugging and logging
* @param options Additional error options
*/
constructor(code: string, message: string, details?: Record<string, unknown> | undefined, options?: {
cause?: Error;
});
/**
* Converts error to a plain object suitable for logging or serialization
*/
toJSON(): Record<string, unknown>;
/**
* Get the HTTP status code corresponding to this error
* Should be overridden by subclasses if needed
*/
getHttpStatusCode(): number;
/**
* Returns true if the error is of the specified class
* Safer than using instanceof when class definitions might be different
*
* @param errorClass Error class to check against
*/
isInstanceOf(errorClass: string): boolean;
/**
* Create a new error with the same code but a new message
* Useful for adding context to existing errors
*
* @param newMessage New error message
* @param additionalDetails Additional details to merge with existing details
*/
abstract withMessage(newMessage: string, additionalDetails?: Record<string, unknown>): BaseError;
}
//# sourceMappingURL=BaseError.d.ts.map