1use cxx::Exception;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
6pub enum Error {
7 #[error(transparent)]
9 LhapdfException(Exception),
10 #[error("{0}")]
12 General(String),
13 #[error("file not found")]
15 Http404,
16 #[error(transparent)]
18 Other(anyhow::Error),
19}
20
21pub type Result<T> = std::result::Result<T, Error>;
23
24impl From<Exception> for Error {
25 fn from(err: Exception) -> Self {
26 Self::LhapdfException(err)
27 }
28}
29
30impl From<std::io::Error> for Error {
31 fn from(err: std::io::Error) -> Self {
32 Self::Other(anyhow::Error::new(err))
33 }
34}