diff --git a/editors/code/src/installation/download_artifact.ts b/editors/code/src/installation/download_artifact.ts index c60014c8c4e..97e4d67c21d 100644 --- a/editors/code/src/installation/download_artifact.ts +++ b/editors/code/src/installation/download_artifact.ts @@ -19,11 +19,10 @@ export async function downloadArtifact( installationDir: string, displayName: string, ) { - await fs.mkdir(installationDir).catch(err => assert.eq( - err?.code, - "EEXIST", + await fs.mkdir(installationDir).catch(err => assert( + err?.code === "EEXIST", `Couldn't create directory "${installationDir}" to download ` + - `${artifactFileName} artifact: ${err.message}` + `${artifactFileName} artifact: ${err?.message}` )); const installationPath = path.join(installationDir, artifactFileName); diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 5c89bc62c12..f56c6badaf3 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -2,7 +2,7 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; -export function assert(condition: unknown, explanation: string): asserts condition { +export function assert(condition: boolean, explanation: string): asserts condition { try { nativeAssert(condition, explanation); } catch (err) { @@ -11,16 +11,6 @@ export function assert(condition: unknown, explanation: string): asserts conditi } } -assert.eq = (bibba: unknown, bobba: T, explanation: string): asserts bibba is T => { - try { - nativeAssert.strictEqual(bibba, bobba, explanation); - } catch (err) { - log.error(`Equality assertion failed:`, explanation); - throw err; - } -}; - - export const log = { enabled: true, debug(message?: any, ...optionalParams: any[]): void {