Skip to main content

kranz_engine/
error.rs

1//! Engine error type.
2//!
3//! CONTRACT FILE — do not modify in implementation phases. If a change seems
4//! necessary, report it instead of editing.
5
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum EngineError {
10    #[error("io error: {0}")]
11    Io(#[from] std::io::Error),
12
13    #[error("json error: {0}")]
14    Json(#[from] serde_json::Error),
15
16    #[error("event log corruption: {0}")]
17    LogCorruption(String),
18
19    #[error("another kranz engine holds the lock for this mission: {0}")]
20    LockHeld(String),
21
22    #[error("git operation failed: {0}")]
23    Git(String),
24
25    #[error("agent backend error: {0}")]
26    Backend(String),
27
28    #[error("mission is in an invalid state for this operation: {0}")]
29    InvalidState(String),
30
31    #[error("configuration error: {0}")]
32    Config(String),
33
34    #[error("{0}")]
35    Other(String),
36}
37
38pub type Result<T> = std::result::Result<T, EngineError>;