1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[error("I/O error: {0}")]
6 Io(#[from] std::io::Error),
7
8 #[error("serialization error: {0}")]
9 Serde(String),
10
11 #[error("invalid Puffin file: {0}")]
12 InvalidPuffin(String),
13
14 #[error("invalid sketch payload: {0}")]
15 InvalidSketch(String),
16
17 #[error("feedback store error: {0}")]
18 Feedback(String),
19
20 #[error("LpBound violation: estimated {estimate} exceeds ceiling {ceiling}")]
21 LpBoundExceeded { estimate: f64, ceiling: f64 },
22}
23
24impl From<bincode::Error> for Error {
25 fn from(e: bincode::Error) -> Self {
26 Error::Serde(e.to_string())
27 }
28}
29
30pub type Result<T> = std::result::Result<T, Error>;