Skip to content

Commit 574dc11

Browse files
author
Veetaha
committed
vscode: removed nested errors as per matklad
1 parent da6ae3b commit 574dc11

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

editors/code/package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editors/code/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"jsonc-parser": "^2.1.0",
2828
"node-fetch": "^2.6.0",
2929
"throttle-debounce": "^2.1.0",
30-
"ts-nested-error": "^1.1.3",
3130
"vscode-languageclient": "^6.1.0"
3231
},
3332
"devDependencies": {

editors/code/src/installation/download_file.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as fs from "fs";
33
import * as stream from "stream";
44
import * as util from "util";
55
import { strict as assert } from "assert";
6-
import { NestedError } from "ts-nested-error";
76

87
const pipeline = util.promisify(stream.pipeline);
98

@@ -19,13 +18,13 @@ export async function downloadFile(
1918
destFilePermissions: number,
2019
onProgress: (readBytes: number, totalBytes: number) => void
2120
): Promise<void> {
22-
const res = await fetch(url).catch(NestedError.rethrow("Failed at initial fetch"));
21+
const res = await fetch(url);
2322

2423
if (!res.ok) {
2524
console.log("Error", res.status, "while downloading file from", url);
2625
console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 });
2726

28-
throw new NestedError(`Got response ${res.status}`);
27+
throw new Error(`Got response ${res.status} when trying to download a file.`);
2928
}
3029

3130
const totalBytes = Number(res.headers.get('content-length'));
@@ -41,7 +40,7 @@ export async function downloadFile(
4140

4241
const destFileStream = fs.createWriteStream(destFilePath, { mode: destFilePermissions });
4342

44-
await pipeline(res.body, destFileStream).catch(NestedError.rethrow("Piping file error"));
43+
await pipeline(res.body, destFileStream);
4544
return new Promise<void>(resolve => {
4645
destFileStream.on("close", resolve);
4746
destFileStream.destroy();

0 commit comments

Comments
 (0)