Skip to content

Commit 4574593

Browse files
committed
Refactor vscode init to use async
Hopefully is a bit easier to read.
1 parent 71850e3 commit 4574593

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/node/routes/vscode.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ router.get("/", async (req, res) => {
2222

2323
const [content, options] = await Promise.all([
2424
await fs.readFile(path.join(rootPath, "src/browser/pages/vscode.html"), "utf8"),
25-
vscode
26-
.initialize(
27-
{
28-
args: req.args,
29-
remoteAuthority: req.headers.host || "",
30-
},
31-
req.query,
32-
)
33-
.catch((error) => {
25+
(async () => {
26+
try {
27+
return await vscode.initialize({ args: req.args, remoteAuthority: req.headers.host || "" }, req.query)
28+
} catch (error) {
3429
const devMessage = commit === "development" ? "It might not have finished compiling." : ""
3530
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
36-
}),
31+
}
32+
})(),
3733
])
3834

3935
options.productConfiguration.codeServerVersion = version

0 commit comments

Comments
 (0)