diff -r 09eb477eec65 -r ab6198160960 rust/hg-pyo3/src/exceptions.rs --- a/rust/hg-pyo3/src/exceptions.rs Thu Feb 06 13:57:51 2025 +0100 +++ b/rust/hg-pyo3/src/exceptions.rs Wed Feb 05 11:04:19 2025 +0100 @@ -2,6 +2,8 @@ use pyo3::import_exception; use pyo3::{create_exception, PyErr}; +use std::fmt::Display; + use hg::dirstate::{on_disk::DirstateV2ParseError, DirstateError}; use hg::revlog::nodemap::NodeMapError; @@ -50,6 +52,11 @@ PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}")) } +#[allow(unused)] +pub fn to_string_value_error(e: T) -> PyErr { + PyValueError::new_err(e.to_string()) +} + pub mod mercurial_py_errors { pyo3::import_exception!(mercurial.error, RevlogError); }