Skip to content

Commit

Permalink
Add clearer error message on module name conversion (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
petereon authored Sep 1, 2024
1 parent 64c64a5 commit fed13ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyo3_bindgen_engine/src/syntax/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,13 @@ impl Module {
};

// Finalize the module with its content
let module_ident: syn::Ident = self.name.name().try_into()?;
let module_ident: syn::Ident = self.name.name().try_into().map_err(|err| {
crate::PyBindgenError::CodegenError(format!(
"Failed to convert module name `{}` to identifier: {}",
self.name.name(),
err
))
})?;
output.extend(quote::quote! {
pub mod #module_ident {
#embed_source_code_fn
Expand Down

0 comments on commit fed13ce

Please sign in to comment.