refactor: improve storage error message #8740
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces significant changes to the
rspack_storagemodule, primarily focusing on enhancing error handling and refactoring the storage system. The key changes include the introduction of new error types, the replacement of existing result types, and the addition of new functionalities to the storage system.Enhancements to Error Handling:
crates/rspack_storage/src/error.rs: Introduced new error typesStorageError,StorageErrorType, andStorageErrorReason, along with theValidateResultenum to improve error handling and diagnostics.crates/rspack_storage/src/fs/error.rs: AddedStorageFSErrorandBatchStorageFSErrorto handle filesystem-specific errors with detailed error messages and operations.Refactoring and Improvements:
crates/rspack_core/src/cache/persistent/storage/memory.rs: ReplacedResultwithStorageResultin theMemoryStoragestruct to align with the new error handling system. [1] [2] [3]crates/rspack_core/src/cache/persistent/storage/mod.rs: Updated thecreate_storagefunction to useStorageBridgeFSinstead ofPackBridgeFS. [1] [2]crates/rspack_storage/src/lib.rs: Refactored the storage trait to use the newStorageResulttype and included the new filesystem module. [1] [2]Addition of New Functionalities:
crates/rspack_storage/src/fs/mod.rs: Added theStorageFStrait and its implementationStorageBridgeFSto handle file system operations, including reading, writing, and metadata management.crates/rspack_storage/src/pack/data/scope.rs: Added anamefield to thePackScopestruct and updated its constructors to include this new field. [1] [2] [3]Checklist