Skip to main content

libbrat_grite/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur when interacting with Grite.
4#[derive(Debug, Error)]
5pub enum GriteError {
6    /// Grit command failed to execute or returned an error.
7    #[error("grite command failed: {0}")]
8    CommandFailed(String),
9
10    /// Entity not found.
11    #[error("not found: {0}")]
12    NotFound(String),
13
14    /// Failed to parse response from Grite.
15    #[error("parse error: {0}")]
16    ParseError(String),
17
18    /// Unexpected response from Grite.
19    #[error("unexpected response: {0}")]
20    UnexpectedResponse(String),
21
22    /// Invalid ID format.
23    #[error("invalid ID format: {0}")]
24    InvalidId(String),
25
26    /// Invalid state transition.
27    #[error("invalid state transition: {0}")]
28    InvalidStateTransition(String),
29
30    /// JSON serialization/deserialization error.
31    #[error("json error: {0}")]
32    Json(#[from] serde_json::Error),
33
34    /// IO error.
35    #[error("io error: {0}")]
36    Io(#[from] std::io::Error),
37}