diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ef665ae2c..b2df95e96d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- `bonsaidb::client::Error` now implements + `From>`. + ### Fixed - `bonsaidb::client::Error::Core`'s `Display` no longer just prints "unexpected diff --git a/crates/bonsaidb-client/src/error.rs b/crates/bonsaidb-client/src/error.rs index 777220ad0e..f1ab6b0973 100644 --- a/crates/bonsaidb-client/src/error.rs +++ b/crates/bonsaidb-client/src/error.rs @@ -1,3 +1,4 @@ +use bonsaidb_core::api::Infallible; use bonsaidb_core::arc_bytes::serde::Bytes; use bonsaidb_core::networking; use bonsaidb_core::schema::Name; @@ -157,3 +158,12 @@ impl From> for bonsaidb_core::Error { } } } + +impl From> for Error { + fn from(err: ApiError) -> Self { + match err { + ApiError::Client(err) => err, + ApiError::Api(_) => unreachable!("infallible"), + } + } +}