facezk-core
Version:
ZKP-AI Proof of Humanity: Live Selfie Check with Biometric Template Extraction and Fuzzy Hashing
106 lines • 4.11 kB
TypeScript
/**
* FaceZK Error Classes
* Comprehensive error handling with specific error types
*/
export declare class FaceZKError extends Error {
readonly code: string;
readonly details?: any;
constructor(message: string, code: string, details?: any);
}
export declare class InitializationError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class TensorFlowError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class ModelError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class ProcessingError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class ValidationError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class PluginError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class CryptoError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class MemoryError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class SecurityError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class AuditError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare class PerformanceError extends FaceZKError {
constructor(message: string, details?: any);
}
export declare const ERROR_CODES: {
readonly INITIALIZATION_ERROR: "INITIALIZATION_ERROR";
readonly TENSORFLOW_ERROR: "TENSORFLOW_ERROR";
readonly MODEL_ERROR: "MODEL_ERROR";
readonly PROCESSING_ERROR: "PROCESSING_ERROR";
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
readonly PLUGIN_ERROR: "PLUGIN_ERROR";
readonly CRYPTO_ERROR: "CRYPTO_ERROR";
readonly MEMORY_ERROR: "MEMORY_ERROR";
readonly SECURITY_ERROR: "SECURITY_ERROR";
readonly AUDIT_ERROR: "AUDIT_ERROR";
readonly PERFORMANCE_ERROR: "PERFORMANCE_ERROR";
};
export declare const ERROR_MESSAGES: {
readonly INITIALIZATION_FAILED: "Failed to initialize FaceZK: {reason}";
readonly TENSORFLOW_INIT_FAILED: "Failed to initialize TensorFlow.js: {reason}";
readonly MODEL_LOAD_FAILED: "Failed to load AI model: {model}";
readonly PROCESSING_FAILED: "Failed to process input: {reason}";
readonly VALIDATION_FAILED: "Validation failed: {field} - {reason}";
readonly PLUGIN_LOAD_FAILED: "Failed to load plugin: {plugin}";
readonly CRYPTO_OPERATION_FAILED: "Cryptographic operation failed: {operation}";
readonly MEMORY_ALLOCATION_FAILED: "Memory allocation failed: {reason}";
readonly SECURITY_VIOLATION: "Security violation detected: {violation}";
readonly AUDIT_LOG_FAILED: "Failed to log audit event: {event}";
readonly PERFORMANCE_THRESHOLD_EXCEEDED: "Performance threshold exceeded: {metric}";
};
export declare const ERROR_SEVERITY: {
readonly LOW: "low";
readonly MEDIUM: "medium";
readonly HIGH: "high";
readonly CRITICAL: "critical";
};
export interface ErrorContext {
timestamp: Date;
sessionId?: string;
userId?: string;
operation: string;
input?: any;
output?: any;
stack?: string;
}
export declare class ContextualError extends FaceZKError {
readonly context: ErrorContext;
constructor(message: string, code: string, context: ErrorContext, details?: any);
}
export declare const ERROR_RECOVERY_STRATEGIES: {
readonly RETRY: "retry";
readonly FALLBACK: "fallback";
readonly DEGRADE: "degrade";
readonly ABORT: "abort";
readonly LOG_AND_CONTINUE: "log_and_continue";
};
export interface ErrorHandler {
handle(error: FaceZKError): Promise<void>;
canRecover(error: FaceZKError): boolean;
getRecoveryStrategy(error: FaceZKError): string;
}
export declare class DefaultErrorHandler implements ErrorHandler {
handle(error: FaceZKError): Promise<void>;
canRecover(error: FaceZKError): boolean;
getRecoveryStrategy(error: FaceZKError): string;
private logToExternalService;
}
//# sourceMappingURL=errors.d.ts.map