1pub enum SuErr {
5 UnsupportedVariant,
7
8 InvalidDomain,
10
11 ExceedMaxPrecision,
13}
14
15pub type SuResult<T> = Result<T, SuErr>;
16pub type SubjectResult = Result<crate::subject::Subject, SuErr>;
17
18#[cfg(feature = "pyo3")]
19mod pysupport {
20 use super::*;
21 use pyo3::exceptions::{PyOverflowError, PyTypeError, PyValueError};
22 use pyo3::PyErr;
23
24 impl From<SuErr> for PyErr {
25 fn from(e: SuErr) -> Self {
26 match e {
27 SuErr::UnsupportedVariant => {
28 PyTypeError::new_err("this operation is not supported on this variant")
29 },
30 SuErr::InvalidDomain => {
31 PyValueError::new_err("the input is not in the valid domain")
32 }
33 SuErr::ExceedMaxPrecision => {
34 PyOverflowError::new_err("the precision exceeded limit during the operation")
35 }
36 }
37 }
38 }
39}