crypto: Expose the crypto store error pulicly

master
Damir Jelić 2021-03-04 17:46:18 +01:00
parent f6f382e28a
commit c5241af675
4 changed files with 10 additions and 3 deletions

View File

@ -20,7 +20,7 @@ use std::io::Error as IoError;
use thiserror::Error; use thiserror::Error;
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use matrix_sdk_crypto::{MegolmError, OlmError}; use matrix_sdk_crypto::{CryptoStoreError, MegolmError, OlmError};
/// Result type of the rust-sdk. /// Result type of the rust-sdk.
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
@ -45,6 +45,12 @@ pub enum Error {
#[error(transparent)] #[error(transparent)]
IoError(#[from] IoError), IoError(#[from] IoError),
/// An error occurred in the crypto store.
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
#[error(transparent)]
CryptoStore(#[from] CryptoStoreError),
/// An error occurred during a E2EE operation. /// An error occurred during a E2EE operation.
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))] #[cfg_attr(feature = "docs", doc(cfg(encryption)))]

View File

@ -54,4 +54,5 @@ pub use requests::{
IncomingResponse, KeysQueryRequest, OutgoingRequest, OutgoingRequests, IncomingResponse, KeysQueryRequest, OutgoingRequest, OutgoingRequests,
OutgoingVerificationRequest, RoomMessageRequest, ToDeviceRequest, OutgoingVerificationRequest, RoomMessageRequest, ToDeviceRequest,
}; };
pub use store::CryptoStoreError;
pub use verification::{Sas, VerificationRequest}; pub use verification::{Sas, VerificationRequest};

View File

@ -504,7 +504,7 @@ impl OlmMachine {
pub async fn get_missing_sessions( pub async fn get_missing_sessions(
&self, &self,
users: impl Iterator<Item = &UserId>, users: impl Iterator<Item = &UserId>,
) -> OlmResult<Option<(Uuid, KeysClaimRequest)>> { ) -> StoreResult<Option<(Uuid, KeysClaimRequest)>> {
self.session_manager.get_missing_sessions(users).await self.session_manager.get_missing_sessions(users).await
} }

View File

@ -189,7 +189,7 @@ impl SessionManager {
pub async fn get_missing_sessions( pub async fn get_missing_sessions(
&self, &self,
users: impl Iterator<Item = &UserId>, users: impl Iterator<Item = &UserId>,
) -> OlmResult<Option<(Uuid, KeysClaimRequest)>> { ) -> StoreResult<Option<(Uuid, KeysClaimRequest)>> {
let mut missing = BTreeMap::new(); let mut missing = BTreeMap::new();
// Add the list of devices that the user wishes to establish sessions // Add the list of devices that the user wishes to establish sessions