rust: Move the errors into a separate module
This commit is contained in:
parent
75838fda2a
commit
2d620e2ddf
rust-sdk/src
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};
|
use tracing_subscriber::{fmt::MakeWriter, EnvFilter};
|
||||||
|
|
||||||
|
mod error;
|
||||||
mod machine;
|
mod machine;
|
||||||
|
|
||||||
pub use machine::{
|
pub use error::*;
|
||||||
CryptoStoreError, Device, DeviceLists, MachineCreationError, OlmMachine, Request, RequestType,
|
pub use machine::{Device, DeviceLists, OlmMachine, Request, RequestType, Sas};
|
||||||
Sas,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub trait Logger: Send {
|
pub trait Logger: Send {
|
||||||
fn log(&self, log_line: String);
|
fn log(&self, log_line: String);
|
||||||
|
@ -17,16 +17,17 @@ use matrix_sdk_common::{
|
|||||||
},
|
},
|
||||||
sync::sync_events::{DeviceLists as RumaDeviceLists, ToDevice},
|
sync::sync_events::{DeviceLists as RumaDeviceLists, ToDevice},
|
||||||
},
|
},
|
||||||
identifiers::{DeviceKeyAlgorithm, Error as RumaIdentifierError, UserId},
|
identifiers::{DeviceKeyAlgorithm, UserId},
|
||||||
uuid::Uuid,
|
uuid::Uuid,
|
||||||
UInt,
|
UInt,
|
||||||
};
|
};
|
||||||
|
|
||||||
use matrix_sdk_crypto::{
|
use matrix_sdk_crypto::{
|
||||||
store::CryptoStoreError as InnerStoreError, IncomingResponse, OlmError,
|
IncomingResponse, OlmMachine as InnerMachine, OutgoingRequest, ToDeviceRequest,
|
||||||
OlmMachine as InnerMachine, OutgoingRequest, ToDeviceRequest,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::error::{CryptoStoreError, MachineCreationError};
|
||||||
|
|
||||||
pub struct OlmMachine {
|
pub struct OlmMachine {
|
||||||
inner: InnerMachine,
|
inner: InnerMachine,
|
||||||
runtime: Runtime,
|
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 {
|
pub enum RequestType {
|
||||||
KeysQuery,
|
KeysQuery,
|
||||||
KeysUpload,
|
KeysUpload,
|
||||||
@ -334,4 +319,3 @@ impl OlmMachine {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user