Skip to content

Commit

Permalink
improve entrypoint error message
Browse files Browse the repository at this point in the history
  • Loading branch information
remybar committed Jan 14, 2025
1 parent 09b00d1 commit 01aad32
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/sozo/src/commands/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ impl ExecuteArgs {
let mut arg_iter = self.calls.into_iter();

Check warning on line 106 in bin/sozo/src/commands/execute.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/execute.rs#L104-L106

Added lines #L104 - L106 were not covered by tests

while let Some(arg) = arg_iter.next() {
let tag_or_address = ResourceDescriptor::from_string(&arg)?;
let descriptor = tag_or_address.ensure_namespace(&profile_config.namespace.default);
let tag_or_address = arg;
let descriptor = ResourceDescriptor::from_string(&tag_or_address)?
.ensure_namespace(&profile_config.namespace.default);

Check warning on line 111 in bin/sozo/src/commands/execute.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/execute.rs#L108-L111

Added lines #L108 - L111 were not covered by tests

let contract_address = match &descriptor {
ResourceDescriptor::Address(address) => Some(*address),
Expand All @@ -128,8 +129,12 @@ impl ExecuteArgs {
anyhow!(message)
})?;

Check warning on line 130 in bin/sozo/src/commands/execute.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/execute.rs#L121-L130

Added lines #L121 - L130 were not covered by tests

let entrypoint =
arg_iter.next().ok_or_else(|| anyhow!("Unexpected number of arguments"))?;
let entrypoint = arg_iter.next().ok_or_else(|| {
anyhow!(
"You must specify the entry point of {tag_or_address} to call, and \
optionally the calldata."
)
})?;

Check warning on line 137 in bin/sozo/src/commands/execute.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/execute.rs#L132-L137

Added lines #L132 - L137 were not covered by tests

let mut calldata = vec![];
for arg in &mut arg_iter {
Expand Down

0 comments on commit 01aad32

Please sign in to comment.