Skip to content

Commit

Permalink
Merge branch 'imp/clean-up-string-variants' of https://github.com/cos…
Browse files Browse the repository at this point in the history
…mos/ibc-rs into imp/clean-up-string-variants
  • Loading branch information
seanchen1991 committed Sep 20, 2024
2 parents b98ae7c + dbf1372 commit bd6e694
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions ibc-core/ics02-client/types/src/height.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//! Defines the core `Height` type used throughout the library

use core::cmp::Ordering;
use core::num::ParseIntError;
use core::str::FromStr;

use displaydoc::Display;
use ibc_core_host_types::error::DecodingError;
use ibc_primitives::prelude::*;
use ibc_proto::ibc::core::client::v1::Height as RawHeight;
Expand Down Expand Up @@ -150,30 +148,6 @@ impl core::fmt::Display for Height {
}
}

/// Encodes all errors related to chain heights
#[derive(Debug, Display, PartialEq, Eq)]
pub enum HeightError {
/// cannot convert into a `Height` type from string `{height}`
HeightConversion {
height: String,
error: ParseIntError,
},
/// attempted to parse an invalid zero height
ZeroHeight,
/// the height(`{raw_height}`) is not a valid format, this format must be used: \[revision_number\]-\[revision_height\]
InvalidFormat { raw_height: String },
}

#[cfg(feature = "std")]
impl std::error::Error for HeightError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match &self {
HeightError::HeightConversion { error: e, .. } => Some(e),
HeightError::ZeroHeight | HeightError::InvalidFormat { .. } => None,
}
}
}

impl TryFrom<&str> for Height {
type Error = DecodingError;

Expand Down

0 comments on commit bd6e694

Please sign in to comment.