Make bootstrap error message more informative and better-fitting

This commit is contained in:
Veetaha 2020-06-22 21:18:36 +03:00
parent eabbeec14c
commit 3fd49d8b94

View File

@ -43,12 +43,16 @@ export async function activate(context: vscode.ExtensionContext) {
const config = new Config(context); const config = new Config(context);
const state = new PersistentState(context.globalState); const state = new PersistentState(context.globalState);
const serverPath = await bootstrap(config, state).catch(err => { const serverPath = await bootstrap(config, state).catch(err => {
let message = "Failed to bootstrap rust-analyzer."; let message = "bootstrap error. ";
if (err.code === "EBUSY" || err.code === "ETXTBSY") { if (err.code === "EBUSY" || err.code === "ETXTBSY") {
message += " Other vscode windows might be using rust-analyzer, " + message += "Other vscode windows might be using rust-analyzer, ";
"you should close them and reload this window to retry."; message += "you should close them and reload this window to retry. ";
} }
message += " Open \"Help > Toggle Developer Tools > Console\" to see the logs";
message += 'Open "Help > Toggle Developer Tools > Console" to see the logs ';
message += '(enable verbose logs with "rust-analyzer.trace.extension")';
log.error("Bootstrap error", err); log.error("Bootstrap error", err);
throw new Error(message); throw new Error(message);
}); });