Skip to content

Commit b88887e

Browse files
author
Veetaha
committed
vscode: add error loging on failed assertion
1 parent 1b9ab04 commit b88887e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

editors/code/src/util.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import * as vscode from "vscode";
33
import { strict as nodeAssert } from "assert";
44

55
export function assert(condition: unknown, explanation: string): asserts condition {
6-
nodeAssert(condition, explanation);
6+
try {
7+
nodeAssert(condition, explanation);
8+
} catch (err) {
9+
log.error(`Assertion failed:`, explanation);
10+
throw err;
11+
}
712
}
813

914
export const log = {

0 commit comments

Comments
 (0)