proteus_lib/peaks/
error.rs1use std::fmt::{Display, Formatter};
2
3#[derive(Debug)]
5pub enum PeaksError {
6 Io(std::io::Error),
7 Decode(String),
8 InvalidFormat(String),
9}
10
11impl Display for PeaksError {
12 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
13 match self {
14 Self::Io(err) => write!(f, "io error: {}", err),
15 Self::Decode(err) => write!(f, "decode error: {}", err),
16 Self::InvalidFormat(err) => write!(f, "invalid peaks format: {}", err),
17 }
18 }
19}
20
21impl std::error::Error for PeaksError {}
22
23impl From<std::io::Error> for PeaksError {
24 fn from(value: std::io::Error) -> Self {
25 Self::Io(value)
26 }
27}