#[derive(Debug, thiserror::Error)]
pub enum FlatError {
#[error("invalid operational template: {0}")]
InvalidTemplate(String),
#[error("failed to parse OPT 1.4 XML: {0}")]
OptParse(#[from] openehr_its::xml::runtime::XmlError),
#[error("failed to serialize to JSON: {0}")]
Serialize(#[from] serde_json::Error),
#[error("malformed simplified path {path:?}: {reason}")]
MalformedPath {
path: String,
reason: String,
},
#[error("unknown simplified path: {0}")]
UnknownPath(String),
#[error("unknown attribute suffix |{suffix} for {rm_type} at {path}")]
UnknownSuffix {
rm_type: String,
suffix: String,
path: String,
},
#[error("|other is mutually exclusive with |code/|value/|terminology at {0}")]
OtherSuffixConflict(String),
#[error("|other not allowed at {0}: the value set is closed")]
OtherOnClosedValueSet(String),
#[error("mandatory ctx field {0} is required (master04 §Context: language and territory)")]
MissingContext(&'static str),
#[error("coded value is not a member of the bound value set: '{code}' at {path}")]
CodeNotInValueSet {
path: String,
code: String,
},
#[error("unknown context key ctx/{0}")]
UnknownContext(String),
#[error("{key} is required")]
MissingRequiredSuffix {
key: String,
},
#[error("invalid value at {path}: {reason}")]
InvalidValue {
path: String,
reason: String,
},
#[error("invalid |raw payload at {path}: {reason}")]
InvalidRaw {
path: String,
reason: String,
},
#[error("simplified-format conversion error: {0}")]
Conversion(String),
}