changeset 52531 | 4c9e31984b3a |
parent 52412 | 6e8ba52857df |
child 52771 | 2fb13c3f4496 |
--- 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<T>(e: std::sync::PoisonError<T>) -> PyErr { + PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}")) +}