Skip to content

fix(macros): correct error messages for input types#552

Merged
sjudson merged 7 commits intonexus-xyz:mainfrom
PivasDesant:fix/input-error-messages
Dec 17, 2025
Merged

fix(macros): correct error messages for input types#552
sjudson merged 7 commits intonexus-xyz:mainfrom
PivasDesant:fix/input-error-messages

Conversation

@PivasDesant
Copy link
Contributor

Fix error messages in handle_input to reflect the actual input type (public/private/custom) instead of always saying "public input". Also correct the comment on line 275 that incorrectly referenced "public output" when it should reference "public/private input".

Error messages now dynamically adapt based on InputType enum, providing accurate feedback to users when using public_input, private_input, or custom_input attributes.

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@PivasDesant
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

let name = id.path.segments.get(0).unwrap().ident.clone();
if public_inputs.contains(&name) {
return stream_error(&attr_args, format!("Duplicate public input: {:?}.", name));
return stream_error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems to be correct.

format!(
"Provided public input does not appear in the function signature: {:?}",
public_inputs
"Provided {} does not appear in the function signature: {:?}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems to be correct.

return stream_error(&attr_args, "Expected at least one public input.");
return stream_error(
&attr_args,
format!("Expected at least one {}.", input_type_label),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a good fix, but the label matching can now be moved inline so it won't be used elsewhere.

#(#attrs)*
fn #fn_name(#input_sig) #output {
let (#(#inputs),*):(#(#types),*) = #input_handler().expect("Failed to read public input");
let (#(#inputs),*):(#(#types),*) = #input_handler().expect(#error_msg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a good fix, but the label matching can be moved inline.

@PivasDesant
Copy link
Contributor Author

PivasDesant commented Dec 11, 2025

@sjudson did I understand you correctly?

@sjudson
Copy link
Contributor

sjudson commented Dec 11, 2025

@PivasDesant Not quite. The ones that I said "look correct" do only work over public inputs so the original error messages are correct.

Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retracting approval @PivasDesant, notice failed tests

@PivasDesant PivasDesant requested a review from sjudson December 16, 2025 19:36
@PivasDesant
Copy link
Contributor Author

hmm... when I was running tests there wasn't this error, strange... sorry

@sjudson
Copy link
Contributor

sjudson commented Dec 17, 2025

@PivasDesant tests are still breaking

@sjudson sjudson merged commit e8ed1d6 into nexus-xyz:main Dec 17, 2025
20 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants