Skip to content

Commit

Permalink
Make manifest address parsing error more descriptive (#75)
Browse files Browse the repository at this point in the history
Signed-off-by: sahithiacn <[email protected]>
Closes: #314
  • Loading branch information
macalinao authored and bors-diem committed Jan 6, 2023
1 parent f1bb624 commit 03a0d82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion language/move-core/types/src/account_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ pub struct AccountAddressParseError;

impl fmt::Display for AccountAddressParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> std::fmt::Result {
write!(f, "Unable to parse AccountAddress")
write!(
f,
"Unable to parse AccountAddress (must be hex string of length {})",
AccountAddress::LENGTH
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ pub fn parse_addresses(tval: TV) -> Result<PM::AddressDeclarations> {
} else if addresses
.insert(
ident,
Some(parse_address_literal(entry_str).context("Invalid address")?),
Some(parse_address_literal(entry_str).context(format!(
"Invalid address '{}' encountered.",
entry_str
))?),
)
.is_some()
{
Expand Down Expand Up @@ -251,7 +254,10 @@ pub fn parse_dev_addresses(tval: TV) -> Result<PM::DevAddressDeclarations> {
} else if addresses
.insert(
ident,
parse_address_literal(entry_str).context("Invalid address")?,
parse_address_literal(entry_str).context(format!(
"Invalid address '{}' encountered.",
entry_str
))?,
)
.is_some()
{
Expand Down

0 comments on commit 03a0d82

Please sign in to comment.