refactor: create separate error enums for vite_task and vite_workspace#273
Merged
branchseer merged 2 commits intomainfrom Oct 29, 2025
Conversation
…orkspace Move error variants to their respective crates to improve modularity and reduce coupling. Each crate now has its own error type for errors it constructs, with vite_error wrapping them via TaskError and WorkspaceError variants. Changes: - Create vite_workspace::Error with workspace-specific variants (DuplicatedPackageName, PackageJsonNotFound, PackageOutsideWorkspace) - Create vite_task::Error with task-specific variants (DuplicatedTask, CycleDependencies, TaskNotFound, etc.) - Create vite_glob::Error to break circular dependency - Remove vite_error dependency from vite_workspace and vite_task - Add TaskError and WorkspaceError wrapper variants to vite_error::Error - Update CLI binding commands to convert between error types - Update test assertions to match new error structure - Remove unnecessary StripPrefixError implementation from vite_error - Replace manual From implementation with #[from] attribute for vite_glob::Error All leaf error types (vite_workspace::Error, vite_task::Error) are now independent and do not depend on vite_error, following proper dependency separation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors error handling by moving error types from the centralized vite_error crate to their respective domain crates (vite_task, vite_workspace, vite_glob). This improves code organization by having errors defined closer to where they're used.
- Error types specific to task management moved to
vite_task::Error - Error types specific to workspace management moved to
vite_workspace::Error - Error types specific to glob patterns moved to
vite_glob::Error vite_errornow wraps domain errors via#[from]variants- Updated all command wrappers to handle error type conversion
Reviewed Changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
crates/vite_error/src/lib.rs |
Removed task/workspace-specific errors, added TaskError and WorkspaceError wrapper variants |
crates/vite_error/Cargo.toml |
Added dependencies on vite_task and vite_workspace for error wrapping |
crates/vite_task/src/error.rs |
New file defining task-specific errors with Workspace variant for nested errors |
crates/vite_task/src/lib.rs |
Exported new Error type and removed vite_error dependency |
crates/vite_task/Cargo.toml |
Replaced vite_error with thiserror dependency |
crates/vite_workspace/src/error.rs |
New file defining workspace-specific errors |
crates/vite_workspace/src/lib.rs |
Exported new Error type and removed vite_error dependency |
crates/vite_workspace/Cargo.toml |
Replaced vite_error with thiserror dependency |
crates/vite_glob/src/error.rs |
New file defining glob-specific errors |
crates/vite_glob/src/lib.rs |
Exported new Error type and removed vite_error dependency |
crates/vite_glob/Cargo.toml |
Replaced vite_error with thiserror dependency |
packages/cli/binding/src/commands/*.rs |
Added error conversion wrappers for builtin command resolution |
packages/cli/binding/src/commands/install.rs |
Updated test assertion to use Error::WorkspaceError |
crates/vite_install/src/package_manager.rs |
Updated test assertions to use vite_workspace::Error |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fengmk2
approved these changes
Oct 29, 2025
Member
Author
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Move error variants to their respective crates to improve modularity and
reduce coupling. Each crate now has its own error type for errors it
constructs, with vite_error wrapping them via TaskError and WorkspaceError
variants.
Changes:
(DuplicatedPackageName, PackageJsonNotFound, PackageOutsideWorkspace)
(DuplicatedTask, CycleDependencies, TaskNotFound, etc.)
All leaf error types (vite_workspace::Error, vite_task::Error) are now
independent and do not depend on vite_error, following proper dependency
separation.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com