codex_patcher/sg/
errors.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum AstGrepError {
5 #[error("invalid pattern: {message}")]
6 InvalidPattern { message: String },
7
8 #[error("pattern matched {count} locations, expected exactly 1")]
9 AmbiguousMatch { count: usize },
10
11 #[error("pattern matched 0 locations")]
12 NoMatch,
13
14 #[error("metavariable '{name}' not found in match")]
15 MetavarNotFound { name: String },
16
17 #[error("replacement would create invalid syntax")]
18 InvalidReplacement,
19
20 #[error("context constraint not satisfied: {message}")]
21 ContextNotSatisfied { message: String },
22
23 #[error("I/O error: {0}")]
24 Io(#[from] std::io::Error),
25}