Skip to content

Commit a0cc33c

Browse files
Do not mask unrelated errors.
1 parent aeb91c3 commit a0cc33c

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/client/common/platform/fileSystem.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { promisify } from 'util';
1010
import * as vscode from 'vscode';
1111
import { createDeferred } from '../utils/async';
1212
import { noop } from '../utils/misc';
13+
import { isFileNotFoundError } from './errors';
1314
import { FileSystemPaths, FileSystemPathUtils } from './fs-paths';
1415
import { TemporaryFileSystem } from './fs-temp';
1516
// prettier-ignore
@@ -47,8 +48,11 @@ async function getFileType(filename: string): Promise<FileType> {
4748
// This shouldn't matter because the only consumers were
4849
// internal methods that have been updated appropriately.
4950
stat = await fs.lstat(filename);
50-
} catch {
51-
return FileType.Unknown;
51+
} catch (err) {
52+
if (isFileNotFoundError(err)) {
53+
return FileType.Unknown;
54+
}
55+
throw err;
5256
}
5357
if (!stat.isSymbolicLink()) {
5458
return convertFileType(stat);
@@ -58,8 +62,11 @@ async function getFileType(filename: string): Promise<FileType> {
5862
// See: https://code.visualstudio.com/api/references/vscode-api#FileType
5963
try {
6064
stat = await fs.stat(filename);
61-
} catch {
62-
return FileType.SymbolicLink;
65+
} catch (err) {
66+
if (isFileNotFoundError(err)) {
67+
return FileType.SymbolicLink;
68+
}
69+
throw err;
6370
}
6471
if (stat.isFile()) {
6572
return FileType.SymbolicLink | FileType.File;
@@ -389,7 +396,10 @@ export class FileSystem implements IFileSystem {
389396
// means that any symlinks are getting resolved.
390397
stat = await this.raw.stat(filename);
391398
} catch (err) {
392-
return false;
399+
if (isFileNotFoundError(err)) {
400+
return false;
401+
}
402+
throw err;
393403
}
394404

395405
if (fileType === undefined) {

0 commit comments

Comments
 (0)