claw_patch/error.rs
1use thiserror::Error;
2
3/// Errors returned by patch codecs and codec lookup.
4#[derive(Debug, Error)]
5pub enum PatchError {
6 /// A requested codec id is not registered.
7 #[error("codec not found: {0}")]
8 CodecNotFound(String),
9 /// Patch application failed.
10 #[error("apply failed: {0}")]
11 ApplyFailed(String),
12 /// Patch inversion failed.
13 #[error("invert failed: {0}")]
14 InvertFailed(String),
15 /// Two patch streams overlap and cannot be commuted.
16 #[error("commute failed: patches overlap")]
17 CommuteFailed,
18 /// Three-way merge could not produce a conflict-free result.
19 #[error("merge3 failed: {0}")]
20 Merge3Failed(String),
21 /// A patch address could not be resolved for the target content.
22 #[error("address resolution failed: {0}")]
23 AddressResolutionFailed(String),
24 /// JSON input could not be parsed by the structural JSON codec.
25 #[error("invalid json: {0}")]
26 InvalidJson(String),
27}