rust/hg-pyo3/src/exceptions.rs
changeset 52784 5e3e8876fd9e
parent 52782 827889802d11
child 52786 4e34e8fd46d4
equal deleted inserted replaced
52783:07740bd86fd9 52784:5e3e8876fd9e
    40 
    40 
    41 pub fn map_lock_error<T>(e: std::sync::PoisonError<T>) -> PyErr {
    41 pub fn map_lock_error<T>(e: std::sync::PoisonError<T>) -> PyErr {
    42     PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}"))
    42     PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}"))
    43 }
    43 }
    44 
    44 
    45 /// Submodule to hold Mercurial errors defined on the Python side
    45 pub fn map_try_lock_error<T>(e: std::sync::TryLockError<T>) -> PyErr {
    46 ///
    46     PyRuntimeError::new_err(format!("In Rust PyO3 bindings: {e}"))
    47 /// This is better for clarity, as many hg-core errors have the same names
    47 }
    48 /// as their Python world counterparts
    48 
    49 pub mod mercurial_py_errors {
    49 pub mod mercurial_py_errors {
    50     pyo3::import_exception!(mercurial.error, RevlogError);
    50     pyo3::import_exception!(mercurial.error, RevlogError);
    51 }
    51 }
    52 
    52 
    53 pub fn revlog_error_from_msg(e: impl ToString) -> PyErr {
    53 pub fn revlog_error_from_msg(e: impl ToString) -> PyErr {