@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
98 lines • 3.94 kB
TypeScript
import { BaseError } from './BaseError.js';
/**
* Error class for domain layer
* Used for business rule violations and domain validation errors
*/
export declare class DomainError extends BaseError {
/**
* Create a new DomainError
*
* @param code Error code (without prefix)
* @param message Human-readable error message
* @param details Additional error details
* @param options Additional error options
*/
constructor(code: string, message: string, details?: Record<string, unknown>, options?: {
cause?: Error;
});
/**
* Domain errors typically correspond to client errors (4xx)
* Override if specific error codes should have different status codes
*/
getHttpStatusCode(): number;
/**
* Create a new DomainError 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
*/
withMessage(newMessage: string, additionalDetails?: Record<string, unknown>): DomainError;
}
/**
* Domain error code constants
*/
export declare const DomainErrorCodes: {
readonly INVALID_DOCUMENT_PATH: "INVALID_DOCUMENT_PATH";
readonly INVALID_DOCUMENT_ID: "INVALID_DOCUMENT_ID";
readonly INVALID_DOCUMENT_FORMAT: "INVALID_DOCUMENT_FORMAT";
readonly DOCUMENT_NOT_FOUND: "DOCUMENT_NOT_FOUND";
readonly DOCUMENT_ALREADY_EXISTS: "DOCUMENT_ALREADY_EXISTS";
readonly INVALID_TAG_FORMAT: "INVALID_TAG_FORMAT";
readonly INVALID_TAG: "INVALID_TAG";
readonly INVALID_BRANCH_NAME: "INVALID_BRANCH_NAME";
readonly BRANCH_NOT_FOUND: "BRANCH_NOT_FOUND";
readonly BRANCH_ALREADY_EXISTS: "BRANCH_ALREADY_EXISTS";
readonly BRANCH_INITIALIZATION_FAILED: "BRANCH_INITIALIZATION_FAILED";
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
readonly UNAUTHORIZED_ACCESS: "UNAUTHORIZED_ACCESS";
readonly REPOSITORY_ERROR: "REPOSITORY_ERROR";
readonly JSON_PARSE_ERROR: "JSON_PARSE_ERROR";
readonly INITIALIZATION_ERROR: "INITIALIZATION_ERROR";
readonly FEATURE_NOT_AVAILABLE: "FEATURE_NOT_AVAILABLE";
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
readonly INVALID_OPERATION: "INVALID_OPERATION";
readonly INVALID_JSON_PATH: "INVALID_JSON_PATH";
readonly INVALID_JSON_PATCH_OPERATION: "INVALID_JSON_PATCH_OPERATION";
readonly JSON_PATCH_FAILED: "JSON_PATCH_FAILED";
readonly PATH_NOT_FOUND: "PATH_NOT_FOUND";
readonly TEST_FAILED: "TEST_FAILED";
};
/**
* Type representing valid domain error codes
*/
export type DomainErrorCode = keyof typeof DomainErrorCodes;
/**
* Factory functions for creating standard domain errors
*/
export declare const DomainErrors: {
/**
* Create a document not found error
*/
documentNotFound: (documentId: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create a branch not found error
*/
branchNotFound: (branchName: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create a validation error
*/
validationError: (message: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create an invalid tag format error
*/
invalidTagFormat: (tag: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create a feature not available error
*/
featureNotAvailable: (featureName: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create an unexpected error
*/
unexpectedError: (message: string, additionalDetails?: Record<string, unknown>) => DomainError;
/**
* Create an invalid operation error
*/
invalidOperation: (operation: string, message: string, additionalDetails?: Record<string, unknown>) => DomainError;
};
//# sourceMappingURL=DomainError.d.ts.map