pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync + 'static>>;
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
#[allow(clippy::module_name_repetitions)]
pub enum DimasError {
#[error("should not happen")]
ShouldNotHappen,
#[error("Publisher 'put' failed")]
Put,
#[error("Publisher 'delete' failed")]
Delete,
#[error("Query 'get' failed")]
Get,
#[error("message encoding failed")]
Encoding,
#[error("converting value into 'Vec<u8>' failed")]
ConvertingValue,
#[error("message decoding failed")]
Decoding,
#[error("read of properties failed")]
ReadProperties,
#[error("write of properties failed")]
WriteProperties,
#[error("could not execute callback")]
ExecuteCallback,
#[error("could not find file: {0}")]
FileNotFound(String),
#[error("modifiying context for {0} failed")]
ModifyContext(String),
#[error("reading context for {0} failed")]
ReadContext(String),
#[error("creation of zenoh session failed with {0}")]
CreateSession(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("activation of zenoh liveliness failed with {0}")]
ActivateLiveliness(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("declaration of zenoh publisher failed with {0}")]
DeclarePublisher(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
#[error(transparent)]
StdError(#[from] Box<dyn std::error::Error + Send + Sync + 'static>),
} #[cfg(test)]
mod tests {
use super::*;
const fn is_normal<T: Sized + Send + Sync + Unpin>() {}
#[test]
const fn normal_types() {
is_normal::<DimasError>();
}
}