Skip to main content

gen_pyo3_error_converter

Function gen_pyo3_error_converter 

Source
pub fn gen_pyo3_error_converter(error: &ErrorDef, core_import: &str) -> String
Expand description

Generate a to_py_err converter function that maps each Rust error variant to a Python exception. Uses Error-suffixed names for variant exceptions (N818 compliance).

When error.methods is non-empty, the constructor receives a tuple (message, status_code, is_transient, error_type) so that the #[getter] impl generated by gen_pyo3_error_methods_impl can read them back.