@the-horizon-dev/fast-face-detection
Version:
Fast face detection package using TensorFlow.js MediaPipe models for browser and Node.js environments
63 lines (62 loc) • 1.72 kB
TypeScript
/**
* Error definitions for face detection
*/
/**
* Error codes for the facial detection package
*/
export declare enum ErrorCode {
UNKNOWN_ERROR = 0,
INVALID_INPUT = 1,
MODEL_LOAD_FAILED = 100,
BACKEND_INITIALIZATION_FAILED = 101,
UNSUPPORTED_ENVIRONMENT = 102,
DETECTION_FAILED = 200,
NO_FACES_DETECTED = 201,
TRACKING_ERROR = 202,
LANDMARK_DETECTION_FAILED = 300,
RESOURCE_EXHAUSTED = 400,
RESOURCE_DISPOSED = 401
}
/**
* Additional error information
*/
export interface ErrorDetails {
code: ErrorCode;
originalError?: Error;
context?: Record<string, unknown>;
}
/**
* Base error class for facial detection
*/
export declare class FaceDetectionError extends Error {
readonly code: ErrorCode;
readonly originalError?: Error;
readonly context?: Record<string, unknown>;
constructor(message: string, details?: ErrorDetails);
toString(): string;
static fromError(error: Error, code?: ErrorCode): FaceDetectionError;
}
/**
* Error for facial detection failures
*/
export declare class FaceDetectorError extends FaceDetectionError {
constructor(message: string, details?: ErrorDetails);
}
/**
* Error for landmark detection failures
*/
export declare class LandmarkDetectorError extends FaceDetectionError {
constructor(message: string, details?: ErrorDetails);
}
/**
* Error for model initialization failures
*/
export declare class ModelInitializationError extends FaceDetectionError {
constructor(message: string, details?: ErrorDetails);
}
/**
* Error for invalid inputs
*/
export declare class InvalidInputError extends FaceDetectionError {
constructor(message: string, context?: Record<string, unknown>);
}