Skip to content

Introduce helper function for Python bindings to handle conversion of Rust error to Python ValueError #59

@derekpierre

Description

@derekpierre

Suggestion from @piotr-roslaniec (#54 (comment)) :

   // Elsewhere
   fn map_py_value_err<T: fmt::Display>(err: T) -> PyErr {
     PyValueError::new_err(format!("{err}"))
   }
    <potential error returning call>.map_err(map_py_value_err)?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions