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/ioutil.ts | |
parent | aab1acaed163f91aa5e89b079c5312336abb2088 (diff) |
fix(std): Use Deno.errors where possible. (#4356)
Diffstat (limited to 'std/io/ioutil.ts')
-rw-r--r-- | std/io/ioutil.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/std/io/ioutil.ts b/std/io/ioutil.ts index 83d639463..cfcfdf794 100644 --- a/std/io/ioutil.ts +++ b/std/io/ioutil.ts @@ -1,5 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { BufReader, UnexpectedEOFError } from "./bufio.ts"; +import { BufReader } from "./bufio.ts"; type Reader = Deno.Reader; type Writer = Deno.Writer; import { assert } from "../testing/asserts.ts"; @@ -37,7 +37,7 @@ export async function readShort(buf: BufReader): Promise<number | Deno.EOF> { const high = await buf.readByte(); if (high === Deno.EOF) return Deno.EOF; const low = await buf.readByte(); - if (low === Deno.EOF) throw new UnexpectedEOFError(); + if (low === Deno.EOF) throw new Deno.errors.UnexpectedEof(); return (high << 8) | low; } @@ -46,7 +46,7 @@ export async function readInt(buf: BufReader): Promise<number | Deno.EOF> { const high = await readShort(buf); if (high === Deno.EOF) return Deno.EOF; const low = await readShort(buf); - if (low === Deno.EOF) throw new UnexpectedEOFError(); + if (low === Deno.EOF) throw new Deno.errors.UnexpectedEof(); return (high << 16) | low; } @@ -57,7 +57,7 @@ export async function readLong(buf: BufReader): Promise<number | Deno.EOF> { const high = await readInt(buf); if (high === Deno.EOF) return Deno.EOF; const low = await readInt(buf); - if (low === Deno.EOF) throw new UnexpectedEOFError(); + if (low === Deno.EOF) throw new Deno.errors.UnexpectedEof(); const big = (BigInt(high) << 32n) | BigInt(low); // We probably should provide a similar API that returns BigInt values. if (big > MAX_SAFE_INTEGER) { |