Skip to content

Commit 04f37fe

Browse files
committed
Replace VError with Error
Because Error now supports the cause argument.
1 parent e7b9e13 commit 04f37fe

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/extension.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as _ from "lodash";
22
import pMap from "p-map";
33
import "source-map-support/register";
4-
import * as VError from "verror";
54
import {
65
commands, CompletionItem, CompletionItemKind, Disposable,
76
ExtensionContext, languages, Location, Position, Range, TextDocument, Uri, window,
@@ -74,7 +73,7 @@ async function performCache(): Promise<void> {
7473
}, { concurrency: 30 });
7574
} catch (err) {
7675
notifier.notify("alert", "Failed to cache the CSS classes in the workspace (click for another attempt)");
77-
throw new VError(err as any, "Failed to parse the documents");
76+
throw new Error("Failed to parse the documents", { cause: err });
7877
}
7978

8079
uniqueDefinitions = _.uniqBy(definitions, (def) => def.className);
@@ -89,8 +88,7 @@ async function performCache(): Promise<void> {
8988
notifier.notify("zap", "CSS classes cached (click to cache again)");
9089
} catch (err) {
9190
notifier.notify("alert", "Failed to cache the CSS classes in the workspace (click for another attempt)");
92-
throw new VError(err as any,
93-
"Failed to cache the class definitions during the iterations over the documents that were found");
91+
throw new Error("Failed to cache the class definitions during the iterations over the documents that were found", { cause: err });
9492
}
9593
}
9694

@@ -283,7 +281,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
283281
registerJavaScriptProviders(javaScriptDisposables);
284282
}
285283
} catch (err) {
286-
const newErr = new VError(err as any, "Failed to automatically reload the extension after the configuration change");
284+
const newErr = new Error("Failed to automatically reload the extension after the configuration change", { cause: err });
287285
console.error(newErr);
288286
window.showErrorMessage(newErr.message);
289287
}
@@ -294,7 +292,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
294292
try {
295293
await cache();
296294
} catch (err) {
297-
const newErr = new VError(err as any, "Failed to cache the CSS classes in the workspace");
295+
const newErr = new Error("Failed to cache the CSS classes in the workspace", { cause: err });
298296
console.error(newErr);
299297
window.showErrorMessage(newErr.message);
300298
}
@@ -317,7 +315,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
317315
try {
318316
await cache();
319317
} catch (err) {
320-
const newErr = new VError(err as any, "Failed to cache the CSS classes in the workspace for the first time");
318+
const newErr = new Error("Failed to cache the CSS classes in the workspace for the first time", { cause: err });
321319
console.error(newErr);
322320
window.showErrorMessage(newErr.message);
323321
}

src/parse-engine-gateway.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as fs from "fs";
2-
import VError = require("verror");
32
import * as vscode from "vscode";
43

54
import CssClassDefinition from "./common/css-class-definition";

0 commit comments

Comments
 (0)