@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
129 lines (128 loc) • 5.29 kB
TypeScript
/**
* Specialized Error Classes for AI Changelog Generator
* Provides domain-specific error handling with rich context and debugging information
* Based on the original lib-old/utils/error-handler.js
*/
/**
* Base error class for domain-specific errors
*/
export declare class AIChangelogError extends Error {
[key: string]: any;
constructor(message: any, type: any, context?: Record<string, any>, originalError?: any);
toJSON(): {
name: string;
message: string;
type: any;
context: any;
timestamp: any;
stack: string | undefined;
originalError: {
name: any;
message: any;
stack: any;
} | null;
};
toString(): string;
}
/**
* Git operation related errors
*/
export declare class GitError extends AIChangelogError {
[key: string]: any;
constructor(message: any, command: any, originalError?: any, context?: Record<string, any>);
static fromCommandFailure(command: any, exitCode: any, stdout: any, stderr: any, originalError?: any): GitError;
static repositoryNotFound(path: any): GitError;
static invalidReference(ref: any, reason?: string): GitError;
static workingDirectoryDirty(files?: any[]): GitError;
}
/**
* Configuration related errors
*/
export declare class ConfigError extends AIChangelogError {
[key: string]: any;
constructor(message: any, configKey: any, originalError?: any, context?: Record<string, any>);
static missingRequired(configKey: any, source?: string): ConfigError;
static invalidValue(configKey: any, value: any, expectedType: any, source?: string): ConfigError;
static fileNotFound(configPath: any): ConfigError;
static parseError(configPath: any, originalError: any): ConfigError;
static providerNotConfigured(providerName: any): ConfigError;
}
/**
* Validation related errors
*/
export declare class ValidationError extends AIChangelogError {
[key: string]: any;
constructor(message: any, field: any, value: any, originalError?: any, context?: Record<string, any>);
static required(field: any): ValidationError;
static invalidType(field: any, value: any, expectedType: any): ValidationError;
static outOfRange(field: any, value: any, min: any, max: any): ValidationError;
static invalidFormat(field: any, value: any, format: any, example?: any): ValidationError;
static custom(field: any, value: any, message: any, context?: Record<string, any>): ValidationError;
}
/**
* AI Provider related errors
*/
export declare class ProviderError extends AIChangelogError {
[key: string]: any;
constructor(message: any, providerName: any, methodName: any, originalError?: any, context?: Record<string, any>);
static notAvailable(providerName: any, reason?: string): ProviderError;
static authenticationFailed(providerName: any, details?: Record<string, any>): ProviderError;
static rateLimitExceeded(providerName: any, retryAfter?: any): ProviderError;
static apiError(providerName: any, methodName: any, statusCode: any, response: any, originalError?: any): ProviderError;
static invalidResponse(providerName: any, methodName: any, response: any, expectedFormat: any): ProviderError;
}
/**
* Abstract method errors (for incomplete implementations)
*/
export declare class AbstractMethodError extends AIChangelogError {
[key: string]: any;
constructor(message: any, className: any, methodName: any, context?: Record<string, any>);
static notImplemented(className: any, methodName: any): AbstractMethodError;
}
/**
* File system related errors
*/
export declare class FileSystemError extends AIChangelogError {
[key: string]: any;
constructor(message: any, operation: any, path: any, originalError?: any, context?: Record<string, any>);
static fileNotFound(path: any): FileSystemError;
static permissionDenied(operation: any, path: any): FileSystemError;
static directoryNotFound(path: any): FileSystemError;
}
/**
* Network related errors
*/
export declare class NetworkError extends AIChangelogError {
[key: string]: any;
constructor(message: any, url: any, operation: any, originalError?: any, context?: Record<string, any>);
static connectionFailed(url: any, originalError?: any): NetworkError;
static timeout(url: any, timeoutMs: any): NetworkError;
static httpError(url: any, statusCode: any, statusText: any): NetworkError;
}
/**
* Parse error for malformed data/responses
*/
export declare class ParseError extends Error {
[key: string]: any;
constructor(message: any, data?: any, originalError?: any);
}
/**
* Concurrency limit error for resource management
*/
export declare class ConcurrencyLimitError extends Error {
[key: string]: any;
constructor(message: any, limit: any, active: any, originalError?: any);
}
/**
* Error context builder utility
*/
export declare class ErrorContext {
[key: string]: any;
constructor();
add(key: any, value: any): this;
addGitInfo(command: any, exitCode: any, stdout: any, stderr: any): this;
addProviderInfo(name: any, model: any, endpoint: any): this;
addFileInfo(path: any, size: any, mtime: any): this;
addUserInfo(action: any, timestamp?: string): this;
build(): any;
}