mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
improved error propagation, #48034
This commit is contained in:
@@ -132,12 +132,18 @@ class ConsumerFileSystem implements vscode.FileSystem {
|
||||
return this._proxy.$copy(source, destination, options).catch(ConsumerFileSystem._handleError);
|
||||
}
|
||||
private static _handleError(err: any): never {
|
||||
if (err instanceof Error && err.name === 'ENOPRO') {
|
||||
throw FileSystemError.Unavailable(err.message);
|
||||
} else {
|
||||
// generic error
|
||||
// generic error
|
||||
if (!(err instanceof Error)) {
|
||||
throw new FileSystemError(String(err));
|
||||
}
|
||||
|
||||
// no provider (unknown scheme) error
|
||||
if (err.name === 'ENOPRO') {
|
||||
throw FileSystemError.Unavailable(err.message);
|
||||
}
|
||||
|
||||
// file system error
|
||||
throw new FileSystemError(err.message, err.name as files.FileSystemProviderErrorCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user