Skip to content

refine: Refine Error#81

Merged
junyu0312 merged 1 commit intomainfrom
refine
Feb 27, 2026
Merged

refine: Refine Error#81
junyu0312 merged 1 commit intomainfrom
refine

Conversation

@junyu0312
Copy link
Owner

@junyu0312 junyu0312 commented Feb 27, 2026

Summary by CodeRabbit

  • Refactor
    • Consolidated error handling across the VM core module by standardizing error types and introducing a unified Result type alias for improved error propagation consistency.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68ebb0f and 4a21ce4.

📒 Files selected for processing (6)
  • crates/vm-core/src/error.rs
  • crates/vm-core/src/lib.rs
  • crates/vm-core/src/virt.rs
  • crates/vm-core/src/virt/hvp.rs
  • crates/vm-core/src/virt/kvm.rs
  • crates/vm-machine/src/vm/error.rs

📝 Walkthrough

Walkthrough

This pull request refactors error handling in the vm-core crate by renaming the VirtError enum to Error, introducing a Result<T> type alias, and exposing the error module publicly. All implementations using these error types are updated consistently across the crate.

Changes

Cohort / File(s) Summary
Error Module Definition
crates/vm-core/src/error.rs
Renamed VirtError enum to Error and added public Result<T> type alias for ergonomic error handling.
Module Exposure
crates/vm-core/src/lib.rs
Exposed the error module in the crate's public API via pub mod error;.
Trait Definition
crates/vm-core/src/virt.rs
Updated the Virt trait to use the simplified Result<Self> return type and removed internal error module re-export. Imports updated to use crate::error::Result.
VM Implementations
crates/vm-core/src/virt/hvp.rs, crates/vm-core/src/virt/kvm.rs
Updated error type from VirtError to Error in all error mappings and constructor signatures. All map_err closures and explicit error returns now use Error variants.
VM Machine Error Handling
crates/vm-machine/src/vm/error.rs
Updated error variant from VirtError to VmError in the Platform enum variant and its corresponding From implementation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop and a skip through error types we go,
VirtError now Error—watch the refactoring flow!
Results wrapped in aliases, tidy and tight,
Every map_err now sparkles with light!
Clean error paths from modules to all,
One little rename has unified them all!

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refine

Comment @coderabbitai help to get the list of available commands and usage tips.

@junyu0312 junyu0312 merged commit 3dc77ae into main Feb 27, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant