Skip to content

Commit 0062339

Browse files
authored
refactor(types): derive MultiMessageAggregateError with thiserror (#428)
Addresses [review feedback on #426](#426 (comment)) left after merge: use `thiserror` instead of manual `Display` / `std::error::Error` impls for `MultiMessageAggregateError`. No behavior change; the error message is identical.
1 parent 8ee2c79 commit 0062339

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

crates/common/types/src/block.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,13 @@ impl MultiMessageAggregate {
7777
}
7878

7979
/// Errors returned when constructing a [`MultiMessageAggregate`].
80-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
80+
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
8181
pub enum MultiMessageAggregateError {
8282
/// Proof bytes exceed `ByteList512KiB`'s cap.
83+
#[error("proof {0} bytes exceeds 512 KiB cap")]
8384
ProofTooLarge(usize),
8485
}
8586

86-
impl core::fmt::Display for MultiMessageAggregateError {
87-
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
88-
match self {
89-
Self::ProofTooLarge(n) => write!(f, "proof {n} bytes exceeds 512 KiB cap"),
90-
}
91-
}
92-
}
93-
94-
impl std::error::Error for MultiMessageAggregateError {}
95-
9687
// ============================================================================
9788
// Type-1 multi-signature
9889
// ============================================================================

0 commit comments

Comments
 (0)