Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/vs/base/browser/indexedDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class IndexedDB {
}
};
transaction.onerror = () => e(transaction.error);
transaction.onabort = () => e(transaction.error);
const request = dbRequestFn(transaction.objectStore(store));
}).finally(() => this.pendingTransactions.splice(this.pendingTransactions.indexOf(transaction), 1));
}
Expand Down
13 changes: 12 additions & 1 deletion src/vs/platform/files/browser/indexedDBFileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const ERR_FILE_NOT_FOUND = createFileSystemProviderError(localize('fileNotExists
const ERR_FILE_IS_DIR = createFileSystemProviderError(localize('fileIsDirectory', "File is Directory"), FileSystemProviderErrorCode.FileIsADirectory);
const ERR_FILE_NOT_DIR = createFileSystemProviderError(localize('fileNotDirectory', "File is not a directory"), FileSystemProviderErrorCode.FileNotADirectory);
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(localize('dirIsNotEmpty', "Directory is not empty"), FileSystemProviderErrorCode.Unknown);
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(localize('fileExceedsStorageQuota', "File exceeds available storage quota"), FileSystemProviderErrorCode.FileExceedsStorageQuota);

// Arbitrary Internal Errors
const ERR_UNKNOWN_INTERNAL = (message: string) => createFileSystemProviderError(localize('internal', "Internal error occurred in IndexedDB File System Provider. ({0})", message), FileSystemProviderErrorCode.Unknown);
Expand Down Expand Up @@ -427,7 +428,17 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst
private async writeMany() {
if (this.fileWriteBatch.length) {
const fileBatch = this.fileWriteBatch.splice(0, this.fileWriteBatch.length);
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => fileBatch.map(entry => objectStore.put(entry.content, entry.resource.path)));
try {
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => fileBatch.map(entry => {
return objectStore.put(entry.content, entry.resource.path);
}));
} catch (ex) {
if (ex instanceof DOMException && ex.name === 'QuotaExceededError') {
throw ERR_FILE_EXCEEDS_STORAGE_QUOTA;
}

throw ex;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/files/common/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ export enum FileSystemProviderErrorCode {
FileNotADirectory = 'EntryNotADirectory',
FileIsADirectory = 'EntryIsADirectory',
FileExceedsMemoryLimit = 'EntryExceedsMemoryLimit',
FileExceedsStorageQuota = 'EntryExceedsStorageQuota',
FileTooLarge = 'EntryTooLarge',
FileWriteLocked = 'EntryWriteLocked',
NoPermissions = 'NoPermissions',
Expand Down