homebridge-gira-client
Version:
Homebridge Plugin für Gira Homeserver 4 mit automatischer Geräteerkennung über IoT REST API
36 lines • 1.65 kB
TypeScript
import { Logger } from 'homebridge';
export declare enum ErrorCode {
CONNECTION_FAILED = "CONNECTION_FAILED",
AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
FUNCTION_NOT_FOUND = "FUNCTION_NOT_FOUND",
INVALID_VALUE = "INVALID_VALUE",
TIMEOUT = "TIMEOUT",
NETWORK_ERROR = "NETWORK_ERROR",
PROTOCOL_ERROR = "PROTOCOL_ERROR",
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
UNKNOWN_ERROR = "UNKNOWN_ERROR"
}
export declare class GiraError extends Error {
readonly code: ErrorCode;
readonly originalError?: Error | undefined;
readonly context?: Record<string, any> | undefined;
constructor(code: ErrorCode, message: string, originalError?: Error | undefined, context?: Record<string, any> | undefined);
}
export declare class ErrorHandler {
private readonly log;
private errorCounts;
private lastErrors;
constructor(log: Logger);
handleError(error: Error | GiraError, context?: Record<string, any>): GiraError;
private categorizeError;
private trackError;
private logError;
getErrorCount(code: ErrorCode): number;
getLastError(code: ErrorCode): Date | undefined;
clearErrorCounts(): void;
isRecurringError(code: ErrorCode, threshold?: number, timeWindowMs?: number): boolean;
}
export declare function withErrorHandling<T>(operation: () => Promise<T>, errorHandler: ErrorHandler, context?: Record<string, any>): Promise<T>;
export declare function withRetry<T>(operation: () => Promise<T>, maxRetries?: number, delayMs?: number, errorHandler?: ErrorHandler): Promise<T>;
//# sourceMappingURL=error-handler.d.ts.map