diff --git a/rust/hg-pyo3/src/exceptions.rs b/rust/hg-pyo3/src/exceptions.rs new file mode 100644 --- /dev/null +++ b/rust/hg-pyo3/src/exceptions.rs @@ -0,0 +1,4 @@ +use pyo3::create_exception; +use pyo3::exceptions::PyValueError; + +create_exception!(pyo3_rustext, GraphError, PyValueError); diff --git a/rust/hg-pyo3/src/lib.rs b/rust/hg-pyo3/src/lib.rs --- a/rust/hg-pyo3/src/lib.rs +++ b/rust/hg-pyo3/src/lib.rs @@ -1,6 +1,7 @@ use pyo3::prelude::*; mod dagops; +mod exceptions; mod util; #[pymodule] @@ -15,5 +16,6 @@ fn pyo3_rustext(py: Python<'_>, m: &Boun let dotted_name = format!("mercurial.{}", name); m.add_submodule(&dagops::init_module(py, &dotted_name)?)?; + m.add("GraphError", py.get_type::())?; Ok(()) }