diff options
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/installation/download_artifact.ts | 7 | ||||
-rw-r--r-- | editors/code/src/util.ts | 12 |
2 files changed, 4 insertions, 15 deletions
diff --git a/editors/code/src/installation/download_artifact.ts b/editors/code/src/installation/download_artifact.ts index c60014c8c..97e4d67c2 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( | |||
19 | installationDir: string, | 19 | installationDir: string, |
20 | displayName: string, | 20 | displayName: string, |
21 | ) { | 21 | ) { |
22 | await fs.mkdir(installationDir).catch(err => assert.eq( | 22 | await fs.mkdir(installationDir).catch(err => assert( |
23 | err?.code, | 23 | err?.code === "EEXIST", |
24 | "EEXIST", | ||
25 | `Couldn't create directory "${installationDir}" to download ` + | 24 | `Couldn't create directory "${installationDir}" to download ` + |
26 | `${artifactFileName} artifact: ${err.message}` | 25 | `${artifactFileName} artifact: ${err?.message}` |
27 | )); | 26 | )); |
28 | 27 | ||
29 | const installationPath = path.join(installationDir, artifactFileName); | 28 | const installationPath = path.join(installationDir, artifactFileName); |
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 5c89bc62c..f56c6bada 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts | |||
@@ -2,7 +2,7 @@ import * as lc from "vscode-languageclient"; | |||
2 | import * as vscode from "vscode"; | 2 | import * as vscode from "vscode"; |
3 | import { strict as nativeAssert } from "assert"; | 3 | import { strict as nativeAssert } from "assert"; |
4 | 4 | ||
5 | export function assert(condition: unknown, explanation: string): asserts condition { | 5 | export function assert(condition: boolean, explanation: string): asserts condition { |
6 | try { | 6 | try { |
7 | nativeAssert(condition, explanation); | 7 | nativeAssert(condition, explanation); |
8 | } catch (err) { | 8 | } catch (err) { |
@@ -11,16 +11,6 @@ export function assert(condition: unknown, explanation: string): asserts conditi | |||
11 | } | 11 | } |
12 | } | 12 | } |
13 | 13 | ||
14 | assert.eq = <T>(bibba: unknown, bobba: T, explanation: string): asserts bibba is T => { | ||
15 | try { | ||
16 | nativeAssert.strictEqual(bibba, bobba, explanation); | ||
17 | } catch (err) { | ||
18 | log.error(`Equality assertion failed:`, explanation); | ||
19 | throw err; | ||
20 | } | ||
21 | }; | ||
22 | |||
23 | |||
24 | export const log = { | 14 | export const log = { |
25 | enabled: true, | 15 | enabled: true, |
26 | debug(message?: any, ...optionalParams: any[]): void { | 16 | debug(message?: any, ...optionalParams: any[]): void { |