aegon-types 0.1.0

Core domain types for Aegon. Not intended for direct use outside the workspace.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Crate-wide error and result types.

/// Errors that can originate from parsing or constructing domain types.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// A required field was absent in the source data.
    #[error("missing required field: {0}")]
    MissingField(&'static str),

    /// A field value did not match the expected format or range.
    #[error("invalid field '{field}': {reason}")]
    InvalidField { field: &'static str, reason: String },
}

/// Convenience alias used throughout the workspace.
pub type Result<T> = std::result::Result<T, Error>;