Skip to content

Commit

Permalink
imp: implement From<Infallible> for ClientError (#1359)
Browse files Browse the repository at this point in the history
* imp: implement Infallible for ClientError

* chore: add changelog
  • Loading branch information
Farhad-Shabani authored Oct 17, 2024
1 parent e50ae6c commit 5c51c7f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [ibc-core] Implement `From<Infallible>` for `ClientError`
([#1356](https://github.com/cosmos/ibc-rs/issues/1356)).
8 changes: 8 additions & 0 deletions ibc-core/ics02-client/types/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Defines the client error type

use core::convert::Infallible;

use displaydoc::Display;
use ibc_core_commitment_types::error::CommitmentError;
use ibc_core_host_types::error::{DecodingError, HostError, IdentifierError};
Expand Down Expand Up @@ -88,6 +90,12 @@ impl From<TimestampError> for ClientError {
}
}

impl From<Infallible> for ClientError {
fn from(value: Infallible) -> Self {
match value {}
}
}

#[cfg(feature = "std")]
impl std::error::Error for ClientError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
Expand Down
6 changes: 6 additions & 0 deletions ibc-core/ics24-host/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ impl From<ProtoError> for DecodingError {
}
}

impl From<ProstError> for DecodingError {
fn from(e: ProstError) -> Self {
Self::Prost(e)
}
}

impl From<Base64Error> for DecodingError {
fn from(e: Base64Error) -> Self {
Self::Base64(e)
Expand Down

0 comments on commit 5c51c7f

Please sign in to comment.