diff options
author | Oliver Lenehan <sunsetkookaburra+github@outlook.com.au> | 2020-03-14 12:40:13 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-13 21:40:13 -0400 |
commit | 0f6acf275370cae09ffb3f6950a3926424f3b024 (patch) | |
tree | e77a2115394f36dcbd899fd8f2d5496ca7bde625 /std/io/iotest.ts | |
parent | aab1acaed163f91aa5e89b079c5312336abb2088 (diff) |
fix(std): Use Deno.errors where possible. (#4356)
Diffstat (limited to 'std/io/iotest.ts')
-rw-r--r-- | std/io/iotest.ts | 11 |
1 files changed, 2 insertions, 9 deletions
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<number | Deno.EOF> { this.count++; if (this.count === 2) { - throw new ErrTimeout(); + throw new Deno.errors.TimedOut(); } return this.r.read(p); } |