extract api-types crate, adopt thiserror for all errors

api-types: standalone crate with DTOs (widget, data source, layout, preset)
extracted from http-api. Shared between http-api and future SPA.

thiserror: replaced all manual Display impls with derive macros across
8 crates (config-sqlite, config-memory, tcp-server, tcp-client,
http-json, rss, media, application).
This commit is contained in:
2026-06-18 23:01:31 +02:00
parent 6e77236936
commit af47e3939c
30 changed files with 79 additions and 98 deletions

View File

@@ -8,6 +8,7 @@ domain.workspace = true
reqwest.workspace = true
quick-xml = { version = "0.37", features = ["serialize"] }
serde.workspace = true
thiserror.workspace = true
[dev-dependencies]
tokio.workspace = true

View File

@@ -1,16 +1,9 @@
#[derive(Debug)]
#[derive(Debug, thiserror::Error)]
pub enum RssError {
Request(reqwest::Error),
#[error("request: {0}")]
Request(#[from] reqwest::Error),
#[error("no url configured")]
NoUrl,
#[error("parse: {0}")]
Parse(String),
}
impl std::fmt::Display for RssError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
RssError::Request(e) => write!(f, "request: {e}"),
RssError::NoUrl => write!(f, "no url configured"),
RssError::Parse(e) => write!(f, "parse: {e}"),
}
}
}