/** * Error Definitions * Issue #136: Phase 1 - Foundation * * Centralized error handling for the application. * SF-SEC-003: Separates client-facing and internal error messages. * * @module errors */ /** * Standard error codes used throughout the application * These codes are safe to expose to clients. */ export declare const ErrorCode: { readonly INVALID_ISSUE_NO: "INVALID_ISSUE_NO"; readonly ISSUE_NO_OUT_OF_RANGE: "ISSUE_NO_OUT_OF_RANGE"; readonly INVALID_BRANCH_NAME: "INVALID_BRANCH_NAME"; readonly BRANCH_NAME_TOO_LONG: "BRANCH_NAME_TOO_LONG"; readonly INVALID_PORT: "INVALID_PORT"; readonly PORT_EXHAUSTED: "PORT_EXHAUSTED"; readonly PORT_IN_USE: "PORT_IN_USE"; readonly WORKTREE_NOT_FOUND: "WORKTREE_NOT_FOUND"; readonly WORKTREE_ALREADY_EXISTS: "WORKTREE_ALREADY_EXISTS"; readonly PID_FILE_EXISTS: "PID_FILE_EXISTS"; readonly PROCESS_NOT_RUNNING: "PROCESS_NOT_RUNNING"; readonly PATH_TRAVERSAL: "PATH_TRAVERSAL"; readonly UNAUTHORIZED: "UNAUTHORIZED"; readonly FORBIDDEN: "FORBIDDEN"; readonly DATABASE_ERROR: "DATABASE_ERROR"; readonly FILESYSTEM_ERROR: "FILESYSTEM_ERROR"; readonly GIT_ERROR: "GIT_ERROR"; readonly TIMEOUT: "TIMEOUT"; readonly UNKNOWN_ERROR: "UNKNOWN_ERROR"; }; export type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode]; /** * Application-specific error class * * @example * ```typescript * throw new AppError('INVALID_ISSUE_NO', 'Issue number must be a positive integer', { received: -1 }); * ``` */ export declare class AppError extends Error { /** * Error code - safe to expose to clients */ readonly code: string; /** * Additional details - may contain sensitive info, log only */ readonly details?: Record; /** * Timestamp when error occurred */ readonly timestamp: string; constructor(code: string, message: string, details?: Record); /** * Create a client-safe representation (excludes sensitive details) */ toClientError(): { code: string; message: string; }; /** * Create a log-safe representation (includes details for debugging) */ toLogError(): { code: string; message: string; details?: Record; timestamp: string; }; } /** * Factory function to create AppError * * @param code - Error code from ErrorCode enum * @param message - Human-readable error message * @param details - Optional additional details (logged, not sent to client) * @returns AppError instance * * @example * ```typescript * throw createAppError(ErrorCode.PORT_EXHAUSTED, 'No available ports in range', { range: [3001, 3100] }); * ``` */ export declare function createAppError(code: string, message: string, details?: Record): AppError; /** * Type guard to check if an error is an AppError * * @param error - Error to check * @returns true if error is an AppError */ export declare function isAppError(error: unknown): error is AppError; /** * Wrap unknown error into AppError * * @param error - Unknown error * @param defaultCode - Default error code if error is not AppError * @returns AppError instance */ export declare function wrapError(error: unknown, defaultCode?: string): AppError; /** * Get error message from unknown error * * @param error - Unknown error * @returns Error message string */ export declare function getErrorMessage(error: unknown): string; //# sourceMappingURL=errors.d.ts.map