Skip to content

Commit

Permalink
Clean up TimestampError
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchen1991 committed Sep 20, 2024
1 parent 9d01b07 commit b98ae7c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ibc-primitives/src/types/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use ibc_proto::Protobuf;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use tendermint::Time;
use time::error::ComponentRange;
use time::macros::offset;
use time::{OffsetDateTime, PrimitiveDateTime};

Expand Down Expand Up @@ -269,16 +268,16 @@ impl scale_info::TypeInfo for Timestamp {

#[derive(Debug, Display, derive_more::From)]
pub enum TimestampError {
/// parsing u64 integer from string error: {0}
/// parse int error: {0}
ParseInt(ParseIntError),
/// try from u64 to `Timestamp` error: {0}
/// try from int error: {0}
TryFromInt(TryFromIntError),
/// failed to convert timestamp: {0}
Conversion(time::error::ComponentRange),
/// invalid date: out of range
InvalidDate,
/// overflowed timestamp when modifying with duration
/// overflowed timestamp
OverflowedTimestamp,
/// timestamp is not set
Conversion(ComponentRange),
}

#[cfg(feature = "std")]
Expand All @@ -287,7 +286,7 @@ impl std::error::Error for TimestampError {
match &self {
Self::ParseInt(e) => Some(e),
Self::TryFromInt(e) => Some(e),
Self::Conversion(e) => Some(e),
// Self::Conversion(e) => Some(e),
_ => None,
}
}
Expand Down

0 comments on commit b98ae7c

Please sign in to comment.