use crate::{
interface::{datastream::object::ObjectError, name::InterfaceNameError, version::VersionError},
mapping::MappingError,
schema::{Aggregation, InterfaceType, SchemaError},
};
use super::{interface::validation::VersionChangeError, mapping::endpoint::EndpointError};
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("cannot parse interface JSON")]
Parse(#[from] serde_json::Error),
#[error("invalid interface JSON schema")]
Schema(#[from] SchemaError),
#[error("invalid interface version")]
Version(#[from] VersionError),
#[error("couldn't parse interface for invalid mapping")]
Mapping(#[from] MappingError),
#[error("couldn't parse object datastream interface")]
Object(#[from] ObjectError),
#[error("couldn't parse object datastream interface")]
Name(#[from] InterfaceNameError),
#[error("Database retention policy set to `use_ttl` but the TTL was not specified")]
MissingTtl,
#[error("invalid endpoint")]
InvalidEndpoint(#[from] EndpointError),
#[error("duplicate endpoint mapping '{endpoint}' and '{duplicate}'")]
DuplicateMapping {
endpoint: String,
duplicate: String,
},
#[error("this version has a different name {name} than the previous version {prev_name}")]
NameMismatch {
name: String,
prev_name: String,
},
#[error("incompatible interface version")]
VersionChange(#[from] VersionChangeError),
#[error("couldn't convert interface, expected {exp_type} {exp_aggregation} but got {got_type} {got_aggregation}")]
InterfaceConversion {
exp_type: InterfaceType,
exp_aggregation: Aggregation,
got_type: InterfaceType,
got_aggregation: Aggregation,
},
#[error("property object are supported")]
PropertyObject,
}