mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
rust: Move the errors into a separate module
This commit is contained in:
parent
75838fda2a
commit
2d620e2ddf
3 changed files with 26 additions and 24 deletions
19
rust-sdk/src/error.rs
Normal file
19
rust-sdk/src/error.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use matrix_sdk_common::identifiers::Error as RumaIdentifierError;
|
||||
|
||||
use matrix_sdk_crypto::{store::CryptoStoreError as InnerStoreError, OlmError};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum MachineCreationError {
|
||||
#[error(transparent)]
|
||||
Identifier(#[from] RumaIdentifierError),
|
||||
#[error(transparent)]
|
||||
CryptoStore(#[from] InnerStoreError),
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum CryptoStoreError {
|
||||
#[error(transparent)]
|
||||
CryptoStore(#[from] InnerStoreError),
|
||||
#[error(transparent)]
|
||||
OlmError(#[from] OlmError),
|
||||
}
|
|
@ -2,12 +2,11 @@ use std::sync::{Arc, Mutex};
|
|||
|
||||
use tracing_subscriber::{fmt::MakeWriter, EnvFilter};
|
||||
|
||||
mod error;
|
||||
mod machine;
|
||||
|
||||
pub use machine::{
|
||||
CryptoStoreError, Device, DeviceLists, MachineCreationError, OlmMachine, Request, RequestType,
|
||||
Sas,
|
||||
};
|
||||
pub use error::*;
|
||||
pub use machine::{Device, DeviceLists, OlmMachine, Request, RequestType, Sas};
|
||||
|
||||
pub trait Logger: Send {
|
||||
fn log(&self, log_line: String);
|
||||
|
|
|
@ -17,16 +17,17 @@ use matrix_sdk_common::{
|
|||
},
|
||||
sync::sync_events::{DeviceLists as RumaDeviceLists, ToDevice},
|
||||
},
|
||||
identifiers::{DeviceKeyAlgorithm, Error as RumaIdentifierError, UserId},
|
||||
identifiers::{DeviceKeyAlgorithm, UserId},
|
||||
uuid::Uuid,
|
||||
UInt,
|
||||
};
|
||||
|
||||
use matrix_sdk_crypto::{
|
||||
store::CryptoStoreError as InnerStoreError, IncomingResponse, OlmError,
|
||||
OlmMachine as InnerMachine, OutgoingRequest, ToDeviceRequest,
|
||||
IncomingResponse, OlmMachine as InnerMachine, OutgoingRequest, ToDeviceRequest,
|
||||
};
|
||||
|
||||
use crate::error::{CryptoStoreError, MachineCreationError};
|
||||
|
||||
pub struct OlmMachine {
|
||||
inner: InnerMachine,
|
||||
runtime: Runtime,
|
||||
|
@ -88,22 +89,6 @@ impl<'a> Into<IncomingResponse<'a>> for &'a OwnedResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum MachineCreationError {
|
||||
#[error(transparent)]
|
||||
Identifier(#[from] RumaIdentifierError),
|
||||
#[error(transparent)]
|
||||
CryptoStore(#[from] InnerStoreError),
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum CryptoStoreError {
|
||||
#[error(transparent)]
|
||||
CryptoStore(#[from] InnerStoreError),
|
||||
#[error(transparent)]
|
||||
OlmError(#[from] OlmError),
|
||||
}
|
||||
|
||||
pub enum RequestType {
|
||||
KeysQuery,
|
||||
KeysUpload,
|
||||
|
@ -334,4 +319,3 @@ impl OlmMachine {
|
|||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue