diff -r 736551565871 -r 4c9e31984b3a rust/hg-pyo3/src/exceptions.rs --- a/rust/hg-pyo3/src/exceptions.rs Sat Dec 07 18:24:24 2024 +0100 +++ b/rust/hg-pyo3/src/exceptions.rs Sat Dec 07 18:38:37 2024 +0100 @@ -1,4 +1,4 @@ -use pyo3::exceptions::PyValueError; +use pyo3::exceptions::{PyRuntimeError, PyValueError}; use pyo3::import_exception; use pyo3::{create_exception, PyErr}; @@ -32,3 +32,7 @@ } } } + +pub fn map_lock_error(e: std::sync::PoisonError) -> PyErr { + PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}")) +}