Skip to main content

ta_changeset/
error.rs

1// error.rs — Error types for the changeset subsystem.
2
3use thiserror::Error;
4
5/// Errors that can occur during changeset operations.
6#[derive(Debug, Error)]
7pub enum ChangeSetError {
8    /// Invalid status transition (e.g., Committed → Draft).
9    #[error("invalid status transition from {from} to {to}")]
10    InvalidTransition { from: String, to: String },
11
12    /// Serialization or deserialization failure.
13    #[error("serialization error: {0}")]
14    SerializationError(#[from] serde_json::Error),
15
16    /// Invalid or malformed data.
17    #[error("invalid data: {0}")]
18    InvalidData(String),
19
20    /// I/O operation failed.
21    #[error("I/O error: {0}")]
22    IoError(#[from] std::io::Error),
23}