use serde deserializer functions to remove duplicated structs, remove TryFrom impls, replace Language enum with wrapper around isolang Language type

This commit is contained in:
2025-07-26 17:15:43 +02:00
parent 4a795819cc
commit 352ac3bd1a
9 changed files with 630 additions and 1464 deletions

View File

@@ -171,6 +171,11 @@ pub enum IdQueryResultError {
IdQueryResult(#[from] IdQueryResponseError),
}
#[derive(Debug, Error)]
pub enum PublicationDemographicError {
InvalidValue,
}
#[derive(Debug, Error, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiError {
@@ -208,6 +213,14 @@ impl fmt::Display for ChapterImagesContentError {
}
}
impl fmt::Display for PublicationDemographicError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::InvalidValue => "InvalidValue".fmt(f),
}
}
}
impl serde::de::Error for JsonError {
fn custom<T: fmt::Display>(msg: T) -> Self {
JsonError::Message(msg.to_string())