fits_io/error.rs
1#[cfg(feature = "serde")]
2use std::fmt::Display;
3use thiserror::Error;
4
5/// What can go wrong converting between FITS values and your own types.
6#[derive(Debug, Error)]
7pub enum Error {
8 /// A value could not be read as the type that was asked for.
9 #[error("Deserialization error: {0}")]
10 DeserializationError(String),
11}
12
13#[cfg(feature = "serde")]
14impl serde::de::Error for Error {
15 fn custom<T>(msg: T) -> Self
16 where
17 T: Display,
18 {
19 Self::DeserializationError(msg.to_string())
20 }
21}