Skip to content

Commit 2761f1d

Browse files
Rename InvalidInput -> ConditionNotMet
1 parent 3920a2e commit 2761f1d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

crates/tlog_tiles/src/tile.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl TileReader for TlogTileRecorder {
708708
if t.height() == TlogTile::HEIGHT {
709709
Ok(TlogTile::new(t.level(), t.level_index(), t.width(), None))
710710
} else {
711-
Err(TlogError::InvalidInput(
711+
Err(TlogError::ConditionNotMet(
712712
"TlogTileRecorder cannot read tiles of height not equal to 8".to_string(),
713713
))
714714
}
@@ -745,21 +745,21 @@ impl TileReader for PreloadedTlogTileReader {
745745
for tile in tiles {
746746
// Convert the tile to a tlog-tile, ie one where height=8 and data=false
747747
if tile.height() != TlogTile::HEIGHT {
748-
return Err(TlogError::InvalidInput(
748+
return Err(TlogError::ConditionNotMet(
749749
"PreloadedTlogTileReader cannot read tiles of height not equal to 8"
750750
.to_string(),
751751
));
752752
}
753753
if tile.is_data() {
754-
return Err(TlogError::InvalidInput(
754+
return Err(TlogError::ConditionNotMet(
755755
"PreloadedTlogTileReader cannot read data tiles".to_string(),
756756
));
757757
}
758758
let tlog_tile = TlogTile::new(tile.level(), tile.level_index(), tile.width(), None);
759759

760760
// Record the tile's contents
761761
let Some(contents) = self.0.get(&tlog_tile) else {
762-
return Err(TlogError::InvalidInput(format!(
762+
return Err(TlogError::ConditionNotMet(format!(
763763
"PreloadedTlogTileReader cannot find {}",
764764
tlog_tile.path()
765765
)));

crates/tlog_tiles/src/tlog.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum TlogError {
4343
#[error("indexes out of order")]
4444
IndexesOutOfOrder,
4545
#[error("unmet input condition: {0}")]
46-
InvalidInput(String),
46+
ConditionNotMet(String),
4747
#[error("missing verifier signature")]
4848
MissingVerifierSignature,
4949
#[error("timestamp is after current time")]
@@ -767,7 +767,7 @@ impl Subtree {
767767
/// Will return an error if `[lo, hi)` is not a valid subtree.
768768
pub fn new(lo: u64, hi: u64) -> Result<Self, TlogError> {
769769
if lo >= hi {
770-
return Err(TlogError::InvalidInput("`lo < hi`".into()));
770+
return Err(TlogError::ConditionNotMet("`lo < hi`".into()));
771771
}
772772
// `s` is the smallest power of 2 that is greater than or equal
773773
// to `lo - hi`.
@@ -782,7 +782,7 @@ impl Subtree {
782782
}
783783
};
784784
if lo & (s - 1) != 0 {
785-
return Err(TlogError::InvalidInput(
785+
return Err(TlogError::ConditionNotMet(
786786
"`lo` must be a multiple of the smallest power of two ≥ `hi - lo`".into(),
787787
));
788788
}
@@ -825,7 +825,7 @@ impl Subtree {
825825
/// Will return an error if `lo ≤ hi`.
826826
pub fn split_interval(lo: u64, hi: u64) -> Result<(Self, Option<Self>), TlogError> {
827827
if lo >= hi {
828-
return Err(TlogError::InvalidInput("`lo < hi`".into()));
828+
return Err(TlogError::ConditionNotMet("`lo < hi`".into()));
829829
}
830830
if hi - lo == 1 {
831831
return Ok((Self { lo, hi }, None));
@@ -954,7 +954,7 @@ impl Subtree {
954954
F: FnMut(&Subtree) -> Vec<T>,
955955
{
956956
if !self.contains_subtree(m) {
957-
return Err(TlogError::InvalidInput(format!(
957+
return Err(TlogError::ConditionNotMet(format!(
958958
"{self} does not contain {m}"
959959
)));
960960
}

0 commit comments

Comments
 (0)