Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: implement From<Infallible> for ClientError #1359

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<ProstError> for DecodingError {
fn from(e: ProstError) -> Self {
Self::Prost(e)
}

Check warning on line 131 in ibc-core/ics24-host/types/src/error.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics24-host/types/src/error.rs#L129-L131

Added lines #L129 - L131 were not covered by tests
}

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