diff --git a/index.ts b/index.ts index 4c081d6..e939c08 100644 --- a/index.ts +++ b/index.ts @@ -76,7 +76,12 @@ export interface I2CSlaveDevice { write16(registerNumber: number, value: number): Promise; } -export class OperationError extends Error {} +export class OperationError extends Error { + constructor(message: string) { + super(message); + this.name = this.constructor.name; + } +} export async function requestI2CAccess(): Promise { const ports = new I2CPortMap(