mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
vscode: add error loging on failed assertion
This commit is contained in:
parent
1b9ab04d4b
commit
b88887e70e
1 changed files with 6 additions and 1 deletions
|
@ -3,7 +3,12 @@ import * as vscode from "vscode";
|
||||||
import { strict as nodeAssert } from "assert";
|
import { strict as nodeAssert } from "assert";
|
||||||
|
|
||||||
export function assert(condition: unknown, explanation: string): asserts condition {
|
export function assert(condition: unknown, explanation: string): asserts condition {
|
||||||
|
try {
|
||||||
nodeAssert(condition, explanation);
|
nodeAssert(condition, explanation);
|
||||||
|
} catch (err) {
|
||||||
|
log.error(`Assertion failed:`, explanation);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const log = {
|
export const log = {
|
||||||
|
|
Loading…
Reference in a new issue