changeset 52862:ffda57aa98fa

rust-pyo3-dirstate: defining FallbackError
author Georges Racinet <georges.racinet@cloudcrane.io>
date Fri, 24 Jan 2025 16:05:16 +0100
parents d0c0ad938eb9
children d9d6ae9b9722
files rust/hg-pyo3/src/dirstate.rs rust/hg-pyo3/src/exceptions.rs
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-pyo3/src/dirstate.rs	Fri Jan 24 15:58:18 2025 +0100
+++ b/rust/hg-pyo3/src/dirstate.rs	Fri Jan 24 16:05:16 2025 +0100
@@ -10,7 +10,7 @@
 //! `hg-core` package.
 //!
 //! From Python, this will be seen as `mercurial.pyo3_rustext.dirstate`
-use crate::utils::new_submodule;
+use crate::{exceptions, utils::new_submodule};
 use pyo3::prelude::*;
 
 pub fn init_module<'py>(
@@ -19,5 +19,6 @@
 ) -> PyResult<Bound<'py, PyModule>> {
     let m = new_submodule(py, package, "dirstate")?;
     m.add("__doc__", "Dirstate - Rust implementation exposed via PyO3")?;
+    m.add("FallbackError", py.get_type::<exceptions::FallbackError>())?;
     Ok(m)
 }
--- a/rust/hg-pyo3/src/exceptions.rs	Fri Jan 24 15:58:18 2025 +0100
+++ b/rust/hg-pyo3/src/exceptions.rs	Fri Jan 24 16:05:16 2025 +0100
@@ -8,6 +8,7 @@
 use crate::revision::PyRevision;
 
 create_exception!(pyo3_rustext, GraphError, PyValueError);
+create_exception!(pyo3_rustext, FallbackError, PyRuntimeError);
 import_exception!(mercurial.error, WdirUnsupported);
 
 impl GraphError {