@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
91 lines • 3.6 kB
TypeScript
import { BaseError } from './BaseError.js';
/**
* Error class for application layer
* Used for use case execution errors and application flow errors
*/
export declare class ApplicationError extends BaseError {
/**
* Create a new ApplicationError
*
* @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;
});
/**
* Application errors may be either client or server errors
* depending on the specific error code
*/
getHttpStatusCode(): number;
/**
* Create a new ApplicationError 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>): ApplicationError;
}
/**
* Application error code constants
*/
export declare const ApplicationErrorCodes: {
readonly INVALID_INPUT: "INVALID_INPUT";
readonly USE_CASE_EXECUTION_FAILED: "USE_CASE_EXECUTION_FAILED";
readonly UNAUTHORIZED: "UNAUTHORIZED";
readonly FORBIDDEN: "FORBIDDEN";
readonly NOT_FOUND: "NOT_FOUND";
readonly CONFLICT: "CONFLICT";
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
readonly UNEXPECTED_CONTROLLER_ERROR: "UNEXPECTED_CONTROLLER_ERROR";
readonly INVALID_STATE: "INVALID_STATE";
readonly OPERATION_NOT_ALLOWED: "OPERATION_NOT_ALLOWED";
readonly CONFIGURATION_ERROR: "CONFIGURATION_ERROR";
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
readonly BRANCH_INITIALIZATION_FAILED: "BRANCH_INITIALIZATION_FAILED";
};
/**
* Type representing valid application error codes
*/
export type ApplicationErrorCode = keyof typeof ApplicationErrorCodes;
/**
* Factory functions for creating standard application errors
*/
export declare const ApplicationErrors: {
/**
* Create an invalid input error
*/
invalidInput: (message: string, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create a not found error
*/
notFound: (resource: string, id: string, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create an unauthorized error
*/
unauthorized: (message: string, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create an execution failed error
*/
executionFailed: (useCaseName: string, cause?: Error, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create an unexpected controller error
*/
unexpectedControllerError: (controllerName: string, cause?: Error, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create a configuration error
*/
configurationError: (message: string, cause?: Error, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create a validation failed error for use cases
*/
validationFailed: (useCaseName: string, message: string, additionalDetails?: Record<string, unknown>) => ApplicationError;
/**
* Create a branch initialization failed error
*/
branchInitializationFailed: (branchName: string, cause?: Error, additionalDetails?: Record<string, unknown>) => ApplicationError;
};
//# sourceMappingURL=ApplicationError.d.ts.map