Unnamed repository; edit this file 'description' to name the repository.
Merge #10222
10222: internal: Add workaround for rename error reporting r=lnicola a=lnicola Fixes #9875 bors r+ Co-authored-by: LaurenČ›iu Nicola <[email protected]>
bors[bot] 2021-09-13
parent cada16f · parent 8522b4a · commit 1ef4b2c
-rw-r--r--editors/code/src/net.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index fbd9434d90..ddab32d020 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -124,9 +124,12 @@ export async function download(opts: DownloadOpts) {
log.info(`Renamed old server binary ${opts.dest.fsPath} to ${oldServerPath.fsPath}`);
} catch (err) {
const fsErr = err as vscode.FileSystemError;
- // This is supposed to return `FileNotFound`, alas...
- if (!fsErr.code || fsErr.code !== "FileNotFound" && fsErr.code !== "EntryNotFound") {
- log.error(`Cannot rename existing server instance: ${err}`);
+
+ // This is supposed to return `FileNotFound` (spelled as `EntryNotFound`)
+ // but instead `code` is `Unknown` and `name` is `EntryNotFound (FileSystemError) (FileSystemError)`.
+ // https://github.com/rust-analyzer/rust-analyzer/pull/10222
+ if (!fsErr.code || fsErr.code !== "EntryNotFound" && fsErr.name.indexOf("EntryNotFound") === -1) {
+ log.error(`Cannot rename existing server instance: ${err}"`);
}
}
try {