Skip to main content

eros_nft/
error.rs

1//! Error types for parsing and validation.
2
3use thiserror::Error;
4
5/// Reasons a `PersonaDraft` or `PersonaManifest` may fail validation.
6#[derive(Debug, Error, PartialEq, Eq)]
7pub enum ValidationError {
8    /// The input was not valid JSON.
9    #[error("invalid JSON: {0}")]
10    InvalidJson(String),
11
12    /// The JSON parsed but did not match the type's structural shape.
13    #[error("type mismatch at {path}: {message}")]
14    TypeMismatch { path: String, message: String },
15
16    /// The JSON matched the type's shape but failed a JSON Schema constraint.
17    #[error("schema violation at {path}: {message}")]
18    SchemaViolation { path: String, message: String },
19
20    /// A spec-required cross-field invariant did not hold (e.g.
21    /// `contains_real_person_likeness=true` requires acknowledgment).
22    #[error("invariant violation: {0}")]
23    InvariantViolation(String),
24}