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(transparent)]
15 Other(anyhow::Error),
16}
17
18pub type Result<T> = std::result::Result<T, Error>;
20
21impl From<Exception> for Error {
22 fn from(err: Exception) -> Self {
23 Self::LhapdfException(err)
24 }
25}
26
27impl From<std::io::Error> for Error {
28 fn from(err: std::io::Error) -> Self {
29 Self::Other(anyhow::Error::new(err))
30 }
31}