Skip to content

Commit 460c7b9

Browse files
committed
fixup! refactor error messages in main
1 parent b734022 commit 460c7b9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/browser/pages/vscode.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ export function main(_document: Document | undefined, _window: Window | undefine
221221
const errorMsgPrefix = "[vscode]"
222222

223223
if (!_document) {
224-
throw new Error(`${errorMsgPrefix} Could not run code-server vscode logic. document is undefined.`)
224+
throw new Error(`document is undefined.`)
225225
}
226226

227227
if (!_window) {
228-
throw new Error(`${errorMsgPrefix} Could not run code-server vscode logic. window is undefined.`)
228+
throw new Error(`window is undefined.`)
229229
}
230230

231231
if (!_localStorage) {
232-
throw new Error(`${errorMsgPrefix} Could not run code-server vscode logic. localStorage is undefined.`)
232+
throw new Error(`localStorage is undefined.`)
233233
}
234234

235235
const options = getOptions()
@@ -250,5 +250,6 @@ export function main(_document: Document | undefined, _window: Window | undefine
250250
try {
251251
main(document, window, localStorage)
252252
} catch (error) {
253+
console.error("[vscode] failed to initialize VS Code")
253254
console.error(error)
254255
}

test/unit/browser/pages/vscode.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,17 @@ describe("vscode", () => {
327327
it("should throw if document is missing", () => {
328328
expect(() => {
329329
main(undefined, window, localStorage)
330-
}).toThrow("[vscode] Could not run code-server vscode logic. document is undefined.")
330+
}).toThrow("document is undefined.")
331331
})
332332
it("should throw if window is missing", () => {
333333
expect(() => {
334334
main(document, undefined, localStorage)
335-
}).toThrow("[vscode] Could not run code-server vscode logic. window is undefined.")
335+
}).toThrow("window is undefined.")
336336
})
337337
it("should throw if localStorage is missing", () => {
338338
expect(() => {
339339
main(document, window, undefined)
340-
}).toThrow("[vscode] Could not run code-server vscode logic. localStorage is undefined.")
340+
}).toThrow("localStorage is undefined.")
341341
})
342342
it("should add loader to self.require", () => {
343343
main(document, window, localStorage)

0 commit comments

Comments
 (0)