Skip to content

Commit 8f21930

Browse files
committed
rephrased error messages
1 parent 0864a16 commit 8f21930

1 file changed

Lines changed: 46 additions & 37 deletions

File tree

crates/core/src/dutydb/memory.rs

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,81 +23,90 @@ use crate::{
2323
/// Error type for DutyDB operations.
2424
#[derive(Debug, thiserror::Error)]
2525
pub enum Error {
26-
/// Duty has already expired; data not stored.
27-
#[error("not storing unsigned data for expired duty")]
26+
/// Duty has already expired; unsigned data will not be stored.
27+
#[error("duty expired: unsigned data will not be stored")]
2828
ExpiredDuty,
2929

3030
/// Proposer data set must contain at most one entry.
31-
#[error("unexpected proposer data set length")]
31+
#[error("proposer data set must contain at most one entry")]
3232
UnexpectedProposerSetLength,
3333

34-
/// DutyBuilderProposer is no longer supported.
35-
#[error("deprecated duty DutyBuilderProposer")]
34+
/// `DutyBuilderProposer` is deprecated and no longer supported.
35+
#[error("DutyBuilderProposer is deprecated and no longer supported")]
3636
DeprecatedDutyBuilderProposer,
3737

38-
/// Duty type is not stored by DutyDB.
39-
#[error("unsupported duty type")]
38+
/// Duty type is not stored by `DutyDB`.
39+
#[error("unsupported duty type: not stored by DutyDB")]
4040
UnsupportedDutyType,
4141

4242
/// DB was shut down before the query could be answered.
43-
#[error("dutydb shutdown")]
43+
#[error("dutydb shutdown: query could not be answered")]
4444
Shutdown,
4545

46-
/// Two validators mapped to the same (slot, commIdx, valIdx) with different
46+
/// Two validators share the same `(slot, commIdx, valIdx)` with different
4747
/// public keys.
48-
#[error("clashing public key")]
48+
#[error(
49+
"clashing public key: two validators share the same (slot, commIdx, valIdx) with different keys"
50+
)]
4951
ClashingPublicKey,
5052

51-
/// Two different attestation data objects for the same (slot, commIdx).
52-
#[error("clashing attestation data")]
53+
/// Two different attestation data objects for the same `(slot, commIdx)`.
54+
#[error("clashing attestation data: two different data objects for the same (slot, commIdx)")]
5355
ClashingAttestationData,
5456

55-
/// Mismatched source checkpoint when storing commIdx=0 compatibility entry.
56-
#[error("clashing attestation data with hardcoded commidx=0 source")]
57+
/// Mismatched source checkpoint in the hardcoded `commIdx=0` compatibility
58+
/// entry.
59+
#[error(
60+
"clashing attestation data with hardcoded commidx=0 source: mismatched source checkpoint"
61+
)]
5762
ClashingAttestationDataCommIdx0Source,
5863

59-
/// Mismatched target checkpoint when storing commIdx=0 compatibility entry.
60-
#[error("clashing attestation data with hardcoded commidx=0 target")]
64+
/// Mismatched target checkpoint in the hardcoded `commIdx=0` compatibility
65+
/// entry.
66+
#[error(
67+
"clashing attestation data with hardcoded commidx=0 target: mismatched target checkpoint"
68+
)]
6169
ClashingAttestationDataCommIdx0Target,
6270

63-
/// Two different aggregated attestations for the same slot+root key.
64-
#[error("clashing data root")]
71+
/// Two different aggregated attestations for the same slot and attestation
72+
/// data root.
73+
#[error("clashing data root: two different aggregated attestations for the same slot and root")]
6574
ClashingDataRoot,
6675

67-
/// Two different sync contributions for the same (slot, subcommIdx, root).
68-
#[error("clashing sync contributions")]
76+
/// Two different sync contributions for the same `(slot, subcommIdx,
77+
/// root)`.
78+
#[error(
79+
"clashing sync contributions: two different contributions for the same (slot, subcommIdx, root)"
80+
)]
6981
ClashingSyncContributions,
7082

7183
/// Two different blocks for the same slot.
72-
#[error("clashing blocks")]
84+
#[error("clashing blocks: two different blocks for the same slot")]
7385
ClashingBlocks,
7486

75-
/// No public key found for the given (slot, commIdx, valIdx).
76-
#[error("pubkey not found")]
87+
/// No public key found for the given `(slot, commIdx, valIdx)`.
88+
#[error("pubkey not found for the given (slot, commIdx, valIdx)")]
7789
PubKeyNotFound,
7890

79-
/// Duty type is not handled by deleteDutyUnsafe.
80-
#[error("unknown duty type")]
91+
/// Duty type is not handled by the delete path.
92+
#[error("unknown duty type: not handled by delete")]
8193
UnknownDutyType,
8294

83-
/// The unsigned data provided does not match the expected type for
84-
/// DutyProposer.
85-
#[error("invalid versioned proposal")]
95+
/// Unsigned data does not match the expected type for `DutyProposer`.
96+
#[error("invalid versioned proposal: unsigned data does not match DutyProposer")]
8697
InvalidVersionedProposal,
8798

88-
/// The unsigned data provided does not match the expected type for
89-
/// DutyAttester.
90-
#[error("invalid unsigned attestation data")]
99+
/// Unsigned data does not match the expected type for `DutyAttester`.
100+
#[error("invalid unsigned attestation data: does not match DutyAttester")]
91101
InvalidAttestationData,
92102

93-
/// The unsigned data provided does not match the expected type for
94-
/// DutyAggregator.
95-
#[error("invalid unsigned aggregated attestation")]
103+
/// Unsigned data does not match the expected type for `DutyAggregator`.
104+
#[error("invalid unsigned aggregated attestation: does not match DutyAggregator")]
96105
InvalidAggregatedAttestation,
97106

98-
/// The unsigned data provided does not match the expected type for
99-
/// DutySyncContribution.
100-
#[error("invalid unsigned sync committee contribution")]
107+
/// Unsigned data does not match the expected type for
108+
/// `DutySyncContribution`.
109+
#[error("invalid unsigned sync committee contribution: does not match DutySyncContribution")]
101110
InvalidSyncContribution,
102111
}
103112

0 commit comments

Comments
 (0)