mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
back to FileError, #47475
This commit is contained in:
@@ -713,7 +713,7 @@ export function createApiFactory(
|
||||
FileChangeType2: extHostTypes.FileChangeType2,
|
||||
FileType2: extHostTypes.FileType2,
|
||||
FileOpenFlags: files.FileOpenFlags,
|
||||
FileError: files.FileError,
|
||||
FileError: extHostTypes.FileError,
|
||||
FoldingRange: extHostTypes.FoldingRange,
|
||||
FoldingRangeKind: extHostTypes.FoldingRangeKind
|
||||
};
|
||||
|
||||
@@ -1838,6 +1838,32 @@ export enum FileType2 {
|
||||
SymbolicLink = 4,
|
||||
}
|
||||
|
||||
export class FileError extends Error {
|
||||
|
||||
static EntryExists(message?: string): FileError {
|
||||
return new FileError(message, 'EntryExists', FileError.EntryExists);
|
||||
}
|
||||
static EntryNotFound(message?: string): FileError {
|
||||
return new FileError(message, 'EntryNotFound', FileError.EntryNotFound);
|
||||
}
|
||||
static EntryNotADirectory(message?: string): FileError {
|
||||
return new FileError(message, 'EntryNotADirectory', FileError.EntryNotADirectory);
|
||||
}
|
||||
static EntryIsADirectory(message?: string): FileError {
|
||||
return new FileError(message, 'EntryIsADirectory', FileError.EntryIsADirectory);
|
||||
}
|
||||
|
||||
constructor(message?: string, code?: string, hide?: Function) {
|
||||
super(message);
|
||||
this.name = code ? `FileError/${code}` : `FileError`;
|
||||
|
||||
if (typeof Error.captureStackTrace === 'function' && typeof hide === 'function') {
|
||||
// nice stack traces
|
||||
Error.captureStackTrace(this, hide);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region folding api
|
||||
|
||||
Reference in New Issue
Block a user