refactor: improve error handling with custom AppError and anyhow#22
Merged
AsfhtgkDavid merged 7 commits intoAsfhtgkDavid:mainfrom Feb 27, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #22 +/- ##
==========================================
- Coverage 80.59% 79.59% -1.01%
==========================================
Files 17 17
Lines 1716 1774 +58
==========================================
+ Hits 1383 1412 +29
- Misses 333 362 +29
🚀 New features to boost your workflow:
|
Owner
|
hmm why fmt failed? |
Contributor
Author
|
I managed to fix it, added a commit) |
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.
Description
This PR overhauls error handling in the project by replacing all instances of
.unwrap()and.expect()in production code with idiomatic Rust error propagation using the?operator and a custom error type. The goal is to eliminate unexpected panics, improve debuggability, and align with best practices.Key changes:
thiserrorandanyhowdependencies.AppErrorenum insrc/error.rscovering I/O, Python, security, configuration, and other error cases.fix/,misc.rs,main.rs, andshells/with?,map_err, andok_or_else.AppResult<T>(type alias forResult<T, AppError>).main.rs, changed return type toanyhow::Result<()>and added context messages..unwrap()for extracting values fromResult, keeping them loud on failure..expect()calls in places where failure is unrecoverable or guaranteed by logic (e.g., raw mode, command selection bounds, hardcoded regex)All existing tests pass, and manual testing confirms no regressions.
Type of Change
Testing
Checklist
Closes #15