Catch more errors

This commit is contained in:
Radon Rosborough 2021-08-26 18:46:04 -07:00
parent d3ab5d6336
commit c9af422461
1 changed files with 66 additions and 54 deletions

View File

@ -417,14 +417,19 @@ export class Session {
}; };
stopLSP = async () => { stopLSP = async () => {
try {
if (this.lsp) { if (this.lsp) {
this.lsp.stopping = true; this.lsp.stopping = true;
this.lsp.proc.kill(); this.lsp.proc.kill();
this.lsp = null; this.lsp = null;
} }
} catch (err) {
logError(err);
}
}; };
startLSP = async () => { startLSP = async () => {
try {
if (this.config.lsp) { if (this.config.lsp) {
await this.stopLSP(); await this.stopLSP();
if (this.config.lsp.setup) { if (this.config.lsp.setup) {
@ -471,15 +476,22 @@ export class Session {
); );
this.send({ event: "lspStarted", root: this.homedir }); this.send({ event: "lspStarted", root: this.homedir });
} }
} catch (err) {
logError(err);
}
}; };
ensure = async (cmd) => { ensure = async (cmd) => {
try {
const code = ( const code = (
await this.run(this.privilegedExec(cmd), { await this.run(this.privilegedExec(cmd), {
check: false, check: false,
}) })
).code; ).code;
this.send({ event: "ensured", code }); this.send({ event: "ensured", code });
} catch (err) {
logError(err);
}
}; };
teardown = async () => { teardown = async () => {