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:
@@ -1,14 +1,7 @@
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum TcpServerError {
|
||||
Io(std::io::Error),
|
||||
Encode(postcard::Error),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for TcpServerError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
TcpServerError::Io(e) => write!(f, "io: {e}"),
|
||||
TcpServerError::Encode(e) => write!(f, "encode: {e}"),
|
||||
}
|
||||
}
|
||||
#[error("io: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("encode: {0}")]
|
||||
Encode(#[from] postcard::Error),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user