Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error handling in OPFSFileSystemProvider #14790

Merged
merged 1 commit into from
Jan 29, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ export class OPFSFileSystemProvider implements FileSystemProviderWithFileReadWri
}

throw createFileSystemProviderError('Unknown file handle error', FileSystemProviderErrorCode.Unknown);

} catch (error) {
throw createFileSystemProviderError(`Error while accessing resource ${resource.toString()}`, FileSystemProviderErrorCode.Unknown);
throw toFileSystemProviderError(error);
}
}

Expand Down Expand Up @@ -262,7 +261,7 @@ async function recursiveFileSystemHandle(handle: FileSystemHandle, pathParts: st
}
// If there are parts left, the handle must be a directory
if (handle.kind !== 'directory') {
throw FileSystemProviderErrorCode.FileNotADirectory;
throw createFileSystemProviderError('Not a directory', FileSystemProviderErrorCode.FileNotADirectory);
}
const dirHandle = handle as FileSystemDirectoryHandle;
// We need to create it and thus we need to stop early to create the file or directory
Expand All @@ -289,7 +288,7 @@ async function recursiveFileSystemHandle(handle: FileSystemHandle, pathParts: st
return recursiveFileSystemHandle(newHandle, pathParts, options);
}

throw FileSystemProviderErrorCode.FileNotFound;
throw createFileSystemProviderError('File not found', FileSystemProviderErrorCode.FileNotFound);
}

// Function to copy directory contents recursively
Expand Down
Loading