kroki_rs/diagrams/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum DiagramError {
6 #[error("Validation failed: {0}")]
8 ValidationFailed(String),
9
10 #[error("Tool not found: '{0}'. Is it installed and in your PATH?")]
12 ToolNotFound(String),
13
14 #[error("'{tool}' timed out after {timeout_ms}ms (input: {bytes} bytes)")]
16 ExecutionTimeout {
17 tool: String,
18 timeout_ms: u64,
19 bytes: usize,
20 },
21
22 #[error("Process execution failed: {0}")]
24 ProcessFailed(String),
25
26 #[error("Failed to decode requested string: {0}")]
28 DecodeFailed(String),
29
30 #[error("Format '{format}' is not supported by provider '{provider}'")]
32 UnsupportedFormat { format: String, provider: String },
33
34 #[error("I/O error: {0}")]
36 Io(#[from] std::io::Error),
37
38 #[error("Internal error: {0}")]
40 Internal(String),
41}
42
43pub type DiagramResult<T> = std::result::Result<T, DiagramError>;