UNPKG

homebridge

Version:
76 lines 2.89 kB
/** * Internal Matter error classes * * Kept in a dedicated lightweight module so consumers like * `ChildBridgeMatterMessageHandler` can `instanceof`-check the sentinel * (MatterAccessoryNotOnBridgeError) without dragging in the heavy * `@matter/*` runtime imports that live in `./types.ts`. * * IMPORTANT: never add a runtime `@matter/*` import to this file — * `matterLazyLoading.spec.ts` treats it as a lightweight module that * core / lightweight consumers are allowed to import eagerly. * * Not to be confused with `./errors.ts`, which holds the plugin-facing * `MatterStatus.*` Matter protocol status errors (those subclass * `@matter/main`'s `StatusResponseError` and are intentionally heavy). */ export declare enum MatterErrorType { INITIALIZATION = "INITIALIZATION", NETWORK = "NETWORK", COMMISSIONING = "COMMISSIONING", DEVICE_SYNC = "DEVICE_SYNC", SERVER = "SERVER", STORAGE = "STORAGE", CONFIGURATION = "CONFIGURATION", DEVICE_ERROR = "DEVICE_ERROR", UNKNOWN = "UNKNOWN" } /** * Matter error details interface */ export interface MatterErrorDetails { type?: MatterErrorType; recoverable?: boolean; code?: string; context?: string; originalError?: Error; } /** * Base internal Matter error — categorises a failure for the * MatterErrorHandler and adds a timestamp / recoverable flag on top of * Node's plain Error. */ export declare class MatterError extends Error { readonly code: string; readonly details?: MatterErrorDetails | undefined; readonly type: MatterErrorType; readonly timestamp: Date; readonly recoverable: boolean; constructor(message: string, code: string, details?: MatterErrorDetails | undefined); } export declare class MatterCommissioningError extends MatterError { constructor(message: string, details?: MatterErrorDetails); } export declare class MatterStorageError extends MatterError { constructor(message: string, details?: MatterErrorDetails); } export declare class MatterDeviceError extends MatterError { constructor(message: string, details?: MatterErrorDetails); } /** * Sentinel thrown when a control command is routed to a bridge that does not * own the target accessory. The parent broadcasts requests to multiple * candidate bridges; bridges that don't have the UUID throw this so the * dispatcher can swallow it silently rather than emitting a spurious "not * found" response back to the UI. * * Identified by `instanceof` rather than message-string matching so future * wording changes don't silently break the routing filter. */ export declare class MatterAccessoryNotOnBridgeError extends MatterDeviceError { constructor(uuid: string); } export declare class MatterNetworkError extends MatterError { constructor(message: string, details?: MatterErrorDetails); } //# sourceMappingURL=MatterError.d.ts.map