Skip to content

Commit

Permalink
Name fields of error variants (#1462)
Browse files Browse the repository at this point in the history
* Name fields of error variants

* Changelog
  • Loading branch information
thibault-martinez authored Dec 23, 2022
1 parent 4d33714 commit 6f6b059
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `TrackedParticipation::answers` field;

### Changed

- Fields of `Error::InputAddressNotFound` are now named;

## 2.0.1-rc.5 - 2022-12-20

### Added
Expand Down
8 changes: 4 additions & 4 deletions client/src/api/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ pub async fn search_address(
return Ok((range.start + index as u32, true));
}
}
Err(crate::error::Error::InputAddressNotFound(
address.to_bech32(bech32_hrp),
format!("{range:?}"),
))
Err(crate::error::Error::InputAddressNotFound {
address: address.to_bech32(bech32_hrp),
range: format!("{range:?}"),
})
}
9 changes: 7 additions & 2 deletions client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ pub enum Error {
#[serde(serialize_with = "display_string")]
CryptoError(#[from] crypto::Error),
/// Address not found
#[error("address: {0} not found in range: {1}")]
InputAddressNotFound(String, String),
#[error("address: {address} not found in range: {range}")]
InputAddressNotFound {
/// The address that was not found.
address: String,
/// The range in which the address was not found.
range: String,
},
/// Invalid amount in API response
#[error("invalid amount in API response: {0}")]
InvalidAmount(String),
Expand Down

0 comments on commit 6f6b059

Please sign in to comment.