-
Notifications
You must be signed in to change notification settings - Fork 105
feat: enhance error handling with IoError and IoErrorMetadata for improved std::io::Error diagnostics for fs errors #480
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
Conversation
…roved std::io::Error diagnostics for fs errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enhances error handling in the wdk-build crate by introducing dedicated IoError and IoErrorMetadata types for I/O operations, providing better context for filesystem-related failures.
- Introduces new error types (
IoErrorandIoErrorMetadata) to wrapstd::io::Errorwith detailed path context - Refactors all filesystem operations throughout the codebase to use these enhanced error types
- Updates error handling in binding generation and file operations to capture and propagate path metadata
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/wdk-sys/build.rs | Updates bindgen file generation to use IoError with path metadata for write operations |
| crates/wdk-build/src/utils.rs | Converts filesystem operations to use IoError with path context for directory reading |
| crates/wdk-build/src/lib.rs | Defines new error types and refactors include/library path validation to use enhanced error handling |
| crates/wdk-build/src/cargo_make.rs | Updates path resolution and file operations to use IoError with detailed path metadata |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…_folder_path` and update references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
krishnakumar4a4
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This pull request refactors error handling for I/O operations in the
wdk-buildcrate, introducing a dedicatedIoErrortype with richer metadata for better diagnostics and context. It also consolidates directory validation logic and simplifies code paths that manipulate file system resources. The changes improve error reporting, code maintainability, and consistency across the crate.Error handling improvements:
IoErrorandIoErrorMetadatatypes incrates/wdk-build/src/lib.rs, replacing direct usage ofstd::io::Errorthroughout the crate. This provides structured context for I/O failures, such as which paths caused errors. TheConfigErrorenum now wrapsIoErrorinstead ofstd::io::Error.crates/wdk-build/src/cargo_make.rs(e.g., path resolution, directory creation, file copying, symlink creation, and reading symlinks) to use the new error type and attach relevant path metadata. [1] [2] [3] [4]Codebase simplification and maintainability:
validate_and_add_folder_pathtoConfigincrates/wdk-build/src/lib.rsfor validating and normalizing directory paths before adding them to collections, reducing code repetition and standardizing error handling for missing directories and path normalization.Other changes:
HeaderNotFounderror variant fromConfigError, as header lookup errors are now handled by standard error paths. [1] [2]into_std_path_buf()for path conversion and updating imports. [1] [2]These changes collectively make error handling more robust and the code easier to maintain and extend.
References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]