From 7f66c4ba38f0d0b9e399b8833eb1a79edbb64db5 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Fri, 18 Oct 2019 21:45:56 +0900 Subject: [PATCH] set this.name property --- index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(