Skip to content

Commit 4c3fa48

Browse files
chaliyclaude
andauthored
refactor(error): add From<regex::Error> impl for Error (#340)
## Summary - Add `Regex` variant to `Error` enum with `#[from] regex::Error` - Handle new variant in `error_kind()` match in tool.rs Closes #319 ## Test plan - [x] `cargo build` succeeds - [x] `cargo test --all-features` passes (all 69 tests pass) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7e67f6b commit 4c3fa48

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

crates/bashkit/src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub enum Error {
4949
#[error("network error: {0}")]
5050
Network(String),
5151

52+
/// Regex compilation or matching error.
53+
#[error("regex error: {0}")]
54+
Regex(#[from] regex::Error),
55+
5256
/// Internal error for unexpected failures.
5357
///
5458
/// THREAT[TM-INT-002]: Unexpected internal failures should not crash the interpreter.

crates/bashkit/src/tool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ fn error_kind(e: &Error) -> String {
671671
Error::CommandNotFound(_) => "command_not_found".to_string(),
672672
Error::ResourceLimit(_) => "resource_limit".to_string(),
673673
Error::Network(_) => "network_error".to_string(),
674+
Error::Regex(_) => "regex_error".to_string(),
674675
Error::Internal(_) => "internal_error".to_string(),
675676
}
676677
}

0 commit comments

Comments
 (0)