webserial-core
Version:
A strongly-typed, event-driven, abstract TypeScript library for the Web Serial API with custom parsers, command queue, handshake validation, and auto-reconnect.
41 lines (40 loc) • 1.2 kB
TypeScript
/**
* @file errors/index.ts
*
* Custom error classes for `webserial-core`. All errors extend the native
* `Error` class and set a stable `name` property for `instanceof` checks
* across environments that may not preserve class names.
*/
/**
* Thrown when a port is requested while another device instance already
* holds an exclusive lock on it.
*/
export declare class SerialPortConflictError extends Error {
constructor(message: string);
}
/**
* Thrown when the user cancels the port-picker dialog or when the browser
* denies permission to access a serial port.
*/
export declare class SerialPermissionError extends Error {
constructor(message: string);
}
/**
* Thrown when a command in the queue does not receive a response before the
* configured `commandTimeout` elapses.
*/
export declare class SerialTimeoutError extends Error {
constructor(message: string);
}
/**
* Thrown when reading from an open serial port fails.
*/
export declare class SerialReadError extends Error {
constructor(message: string);
}
/**
* Thrown when writing to an open serial port fails.
*/
export declare class SerialWriteError extends Error {
constructor(message: string);
}