draxl_patch/error.rs
1use std::fmt;
2
3/// Error produced while applying a patch operation.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct PatchError {
6 /// Human-readable description of the patch failure.
7 pub message: String,
8}
9
10impl fmt::Display for PatchError {
11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12 f.write_str(&self.message)
13 }
14}
15
16impl std::error::Error for PatchError {}
17
18pub(crate) fn patch_error(message: &str) -> PatchError {
19 PatchError {
20 message: message.to_owned(),
21 }
22}