Skip to main content

ferro_projections/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("service definition error: {0}")]
6    Definition(String),
7    #[error("validation error: {0}")]
8    Validation(String),
9    #[error("render error: {0}")]
10    Render(String),
11    #[error("serialization error: {0}")]
12    Serialization(#[from] serde_json::Error),
13    /// Caller supplied an empty intents slice — no render target exists.
14    /// Returned by render entry points instead of a silent `"unknown"`;
15    /// defined here so non-visual renderers can consume it. (D-08)
16    #[error("cannot render service with no intents")]
17    NoIntents,
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23
24    #[test]
25    fn no_intents_error_message() {
26        let err = Error::NoIntents;
27        assert_eq!(err.to_string(), "cannot render service with no intents");
28    }
29}