Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer error message on module name conversion #26

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading