fix(macros): correct error messages for input types#552
fix(macros): correct error messages for input types#552sjudson merged 7 commits intonexus-xyz:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
runtime/macros/src/io.rs
Outdated
| 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( |
There was a problem hiding this comment.
This one seems to be correct.
runtime/macros/src/io.rs
Outdated
| format!( | ||
| "Provided public input does not appear in the function signature: {:?}", | ||
| public_inputs | ||
| "Provided {} does not appear in the function signature: {:?}", |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
This one is a good fix, but the label matching can now be moved inline so it won't be used elsewhere.
runtime/macros/src/io.rs
Outdated
| #(#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); |
There was a problem hiding this comment.
This one is a good fix, but the label matching can be moved inline.
|
@sjudson did I understand you correctly? |
|
@PivasDesant Not quite. The ones that I said "look correct" do only work over public inputs so the original error messages are correct. |
sjudson
left a comment
There was a problem hiding this comment.
Retracting approval @PivasDesant, notice failed tests
|
hmm... when I was running tests there wasn't this error, strange... sorry |
|
@PivasDesant tests are still breaking |
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.