mcp-chain-of-draft-server
Version:
A Model Context Protocol server which provides Chain of Draft style thinking
36 lines (35 loc) • 993 B
JavaScript
export class BaseError extends Error {
constructor(message, code, status, details) {
super(message);
this.name = this.constructor.name;
this.code = code;
this.status = status;
this.details = details;
Error.captureStackTrace(this, this.constructor);
}
}
export class ValidationError extends BaseError {
constructor(message, details) {
super(message, 'VALIDATION_ERROR', 400, details);
}
}
export class EntityNotFoundError extends BaseError {
constructor(message) {
super(message, 'NOT_FOUND', 404);
}
}
export class DatabaseError extends BaseError {
constructor(message, details) {
super(message, 'DATABASE_ERROR', 500, details);
}
}
export class UnauthorizedError extends BaseError {
constructor(message) {
super(message, 'UNAUTHORIZED', 401);
}
}
export class ForbiddenError extends BaseError {
constructor(message) {
super(message, 'FORBIDDEN', 403);
}
}