Skip to content

Commit

Permalink
✨ Improved errors for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nwrenger committed Aug 20, 2024
1 parent 3f2c3b2 commit 3adeedb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,10 @@ impl FnInfo {
None
}
}
syn::FnArg::Receiver(_) => {
Some(Err(s_err(param.span(), "Receiver parameter not allowed")))
}
syn::FnArg::Receiver(_) => Some(Err(s_err(
param.span(),
format!("Receiver parameter in function '{}' not allowed", name),
))),
})
.collect::<syn::Result<Vec<_>>>()?;

Expand All @@ -648,7 +649,10 @@ impl FnInfo {
process_rust_type(&rust_type, &mut dependencies, &[]);
rust_type
} else {
return Err(s_err(ty.span(), "Unsupported return type"));
return Err(s_err(
ty.span(),
format!("Unsupported return type in function '{}'", name),
));
}
}
syn::ReturnType::Default => RustType::BuiltIn("()".to_string()),
Expand Down

0 comments on commit 3adeedb

Please sign in to comment.