From 0f6acf275370cae09ffb3f6950a3926424f3b024 Mon Sep 17 00:00:00 2001 From: Oliver Lenehan Date: Sat, 14 Mar 2020 12:40:13 +1100 Subject: fix(std): Use Deno.errors where possible. (#4356) --- std/io/iotest.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'std/io/iotest.ts') diff --git a/std/io/iotest.ts b/std/io/iotest.ts index 8d2cee6e2..1e922e33f 100644 --- a/std/io/iotest.ts +++ b/std/io/iotest.ts @@ -36,14 +36,7 @@ export class HalfReader implements Reader { } } -export class ErrTimeout extends Error { - constructor() { - super("timeout"); - this.name = "ErrTimeout"; - } -} - -/** TimeoutReader returns ErrTimeout on the second read +/** TimeoutReader returns `Deno.errors.TimedOut` on the second read * with no data. Subsequent calls to read succeed. */ export class TimeoutReader implements Reader { @@ -53,7 +46,7 @@ export class TimeoutReader implements Reader { async read(p: Uint8Array): Promise { this.count++; if (this.count === 2) { - throw new ErrTimeout(); + throw new Deno.errors.TimedOut(); } return this.r.read(p); } -- cgit v1.2.3