Skip to main content

nyx_space/python/
errors.rs

1use crate::{
2    NyxError,
3    io::{ConfigError, InputOutputError},
4    md::trajectory::TrajError,
5};
6use pyo3::{exceptions::PyException, prelude::*};
7
8impl From<InputOutputError> for PyErr {
9    fn from(err: InputOutputError) -> PyErr {
10        PyException::new_err(err.to_string())
11    }
12}
13impl From<ConfigError> for PyErr {
14    fn from(err: ConfigError) -> PyErr {
15        PyException::new_err(err.to_string())
16    }
17}
18impl From<TrajError> for PyErr {
19    fn from(err: TrajError) -> PyErr {
20        PyException::new_err(err.to_string())
21    }
22}
23impl From<NyxError> for PyErr {
24    fn from(err: NyxError) -> PyErr {
25        PyException::new_err(err.to_string())
26    }
27}