apache_datasketches/error.rs
1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum SketchError {
5 #[error("invalid sketch configuration: {0}")]
6 InvalidConfig(String),
7
8 #[error("failed to deserialize sketch: {0}")]
9 Deserialization(String),
10
11 #[error("datasketches C++ error: {0}")]
12 Cpp(String),
13}
14
15impl From<cxx::Exception> for SketchError {
16 fn from(e: cxx::Exception) -> Self {
17 SketchError::Cpp(e.what().to_string())
18 }
19}