quick_error! {
#[derive(Debug, PartialEq)]
pub enum Error {
StaticError(message: &'static str) {
from()
display("{message}")
}
DynamicError(message: String) {
from()
display("{message}")
}
FailReadingNextBytes {
display("A 80 bytes card could not be read. A fits file must have a multiple of 80 characters.")
}
FailFindingKeyword(keyword: String) {
display("{keyword} keyword has not been found.")
}
WCS {
from(wcs::error::Error)
display("WCS parsing")
}
NotSupportedXtensionType(extension: String) {
display("{extension} extension is not supported. Only BINTABLE, TABLE and IMAGE are.")
}
Utf8 {
from(std::str::Utf8Error)
display("Fail to parse a keyword as a utf8 string")
}
Io(kind: std::io::ErrorKind) {
from(err: std::io::Error) -> (err.kind())
}
}
}
impl serde::de::Error for Error {
fn custom<T: std::fmt::Display>(msg: T) -> Self {
Error::DynamicError(msg.to_string())
}
}