mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
files2 - mkdirp throws any erorr that is not FileNotFound
This commit is contained in:
@@ -13,7 +13,7 @@ import { startsWith } from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files';
|
||||
|
||||
function es5ClassCompat(target: Function): any {
|
||||
///@ts-ignore
|
||||
@@ -2188,27 +2188,30 @@ export enum FileChangeType {
|
||||
export class FileSystemError extends Error {
|
||||
|
||||
static FileExists(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'EntryExists', FileSystemError.FileExists);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileExists, FileSystemError.FileExists);
|
||||
}
|
||||
static FileNotFound(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'EntryNotFound', FileSystemError.FileNotFound);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileNotFound, FileSystemError.FileNotFound);
|
||||
}
|
||||
static FileNotADirectory(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'EntryNotADirectory', FileSystemError.FileNotADirectory);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileNotADirectory, FileSystemError.FileNotADirectory);
|
||||
}
|
||||
static FileIsADirectory(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'EntryIsADirectory', FileSystemError.FileIsADirectory);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileIsADirectory, FileSystemError.FileIsADirectory);
|
||||
}
|
||||
static NoPermissions(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'NoPermissions', FileSystemError.NoPermissions);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.NoPermissions, FileSystemError.NoPermissions);
|
||||
}
|
||||
static Unavailable(messageOrUri?: string | URI): FileSystemError {
|
||||
return new FileSystemError(messageOrUri, 'Unavailable', FileSystemError.Unavailable);
|
||||
return new FileSystemError(messageOrUri, FileSystemProviderErrorCode.Unavailable, FileSystemError.Unavailable);
|
||||
}
|
||||
|
||||
constructor(uriOrMessage?: string | URI, code?: string, terminator?: Function) {
|
||||
super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);
|
||||
this.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
|
||||
|
||||
// mark the error as file system provider error so that
|
||||
// we can extract the error code on the receiving side
|
||||
markAsFileSystemProviderError(this);
|
||||
|
||||
// workaround when extending builtin objects and when compiling to ES5, see:
|
||||
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
||||
|
||||
Reference in New Issue
Block a user