feat(ffi): expose BeaconError from sdk to ffi
Benchmarks / Run Benchmarks (crypto_bench) (push) Failing after 1m29s
Benchmarks / Run Benchmarks (event_cache) (push) Failing after 6s
Benchmarks / Run Benchmarks (linked_chunk) (push) Failing after 6s
Benchmarks / Run Benchmarks (room_list) (push) Failing after 7s
Benchmarks / Run Benchmarks (store_bench) (push) Failing after 7s
Benchmarks / Run Benchmarks (timeline) (push) Failing after 7s
Bindings tests / xtask (push) Failing after 2m6s
Bindings tests / Run Complement Crypto tests (push) Failing after 0s
Rust tests / xtask (push) Failing after 42s
Rust tests / 🐧 [m], experimental-encrypted-state-events (push) Has been skipped
Rust tests / 🐧 [m], markdown (push) Has been skipped
Rust tests / 🐧 [m], no-encryption (push) Has been skipped
Rust tests / 🐧 [m], no-encryption-and-sqlite (push) Has been skipped
Rust tests / 🐧 [m], no-sqlite (push) Has been skipped
Rust tests / 🐧 [m], search (push) Has been skipped
Rust tests / 🐧 [m], socks (push) Has been skipped
Rust tests / 🐧 [m], sqlite-cryptostore (push) Has been skipped
Rust tests / 🐧 [m], sso-login (push) Has been skipped
Rust tests / 🐧 [m]-examples (push) Has been skipped
Rust tests / 🐧 [m]-crypto (push) Has been skipped
Rust tests / 🕸️ [m]-indexeddb (push) Has been skipped
Rust tests / 🕸️ [m]-base (push) Has been skipped
Rust tests / 🕸️ [m]-common (push) Has been skipped
Rust tests / 🕸️ [m], indexeddb stores (push) Has been skipped
Rust tests / 🕸️ [m], indexeddb stores, no crypto (push) Has been skipped
Rust tests / 🕸️ [m], no-default (push) Has been skipped
Rust tests / 🕸️ [m]-qrcode (push) Has been skipped
Rust tests / 🕸️ [m]-ui (push) Has been skipped
Rust tests / Lint (push) Has been skipped
Rust tests / 🐧 all crates, 🦀 beta (push) Failing after 1m4s
Rust tests / 🐧 all crates, 🦀 stable (push) Failing after 31s
Rust tests / Spell Check with Typos (push) Failing after 1m43s
Rust tests / Integration test (features: default) (push) Failing after 1m20s
Rust tests / Integration test (features: experimental-encrypted-state-events) (push) Failing after 36s
Code Coverage / xtask (push) Failing after 29s
Code Coverage / Code Coverage (push) Has been skipped
Documentation / All crates (push) Failing after 2m1s
Rust version / msrv (push) Failing after 40s
Lint GHA workflows with zizmor / Run zizmor (push) Failing after 9m53s
Bindings tests / Test UniFFI bindings generation (push) Has been skipped
Bindings tests / matrix-rust-components-kotlin (push) Has been skipped
Bindings tests / Generate Crypto FFI Apple XCFramework (push) Has been cancelled
Rust tests / 🍏 all crates, 🦀 stable (push) Has been cancelled
Bindings tests / matrix-rust-components-swift (push) Has been cancelled

This commit is contained in:
ganfra
2026-04-22 17:41:08 +02:00
committed by Damir Jelić
parent 2c2e0f1b15
commit f92ccd8d40
4 changed files with 50 additions and 17 deletions
+33
View File
@@ -345,6 +345,39 @@ pub enum RoomError {
FailedSendingAttachment,
}
#[derive(Debug, thiserror::Error, uniffi::Error)]
#[uniffi(flat_error)]
pub enum LiveLocationError {
#[error("Network error")]
Network,
#[error("Existing beacon information not found")]
NotFound,
#[error("Beacon event is redacted and cannot be processed")]
Redacted,
#[error("Must join the room to access beacon information")]
Stripped,
#[error("The beacon event has expired")]
NotLive,
#[error("Deserialization error")]
Deserialization,
#[error("Other error: {msg}")]
Other { msg: String },
}
impl From<matrix_sdk::BeaconError> for LiveLocationError {
fn from(value: matrix_sdk::BeaconError) -> Self {
match value {
matrix_sdk::BeaconError::Network(_) => Self::Network,
matrix_sdk::BeaconError::NotFound => Self::NotFound,
matrix_sdk::BeaconError::Redacted => Self::Redacted,
matrix_sdk::BeaconError::Stripped => Self::Stripped,
matrix_sdk::BeaconError::Deserialization(_) => Self::Deserialization,
matrix_sdk::BeaconError::NotLive => Self::NotLive,
matrix_sdk::BeaconError::Other(err) => Self::Other { msg: err.to_string() },
}
}
}
#[derive(Debug, thiserror::Error, uniffi::Error)]
#[uniffi(flat_error)]
pub enum MediaInfoError {
+8 -8
View File
@@ -53,7 +53,10 @@ use crate::{
TaskHandle,
chunk_iterator::ChunkIterator,
client::{JoinRule, RoomVisibility},
error::{ClientError, MediaInfoError, NotYetImplemented, QueueWedgeError, RoomError},
error::{
ClientError, LiveLocationError, MediaInfoError, NotYetImplemented, QueueWedgeError,
RoomError,
},
event::TimelineEvent,
identity_status_change::IdentityStatusChange,
live_location_share::LiveLocationShares,
@@ -1084,17 +1087,14 @@ impl Room {
}
/// Stop the current users live location share in the room.
pub async fn stop_live_location_share(&self) -> Result<(), ClientError> {
self.inner.stop_live_location_share().await.expect("Unable to stop live location share");
pub async fn stop_live_location_share(&self) -> Result<(), LiveLocationError> {
self.inner.stop_live_location_share().await?;
Ok(())
}
/// Send the current users live location beacon in the room.
pub async fn send_live_location(&self, geo_uri: String) -> Result<(), ClientError> {
self.inner
.send_location_beacon(geo_uri)
.await
.expect("Unable to send live location beacon");
pub async fn send_live_location(&self, geo_uri: String) -> Result<(), LiveLocationError> {
self.inner.send_location_beacon(geo_uri).await?;
Ok(())
}
+7 -7
View File
@@ -636,31 +636,31 @@ impl From<ReqwestError> for Error {
/// Errors that can happen when interacting with the beacon API.
#[derive(Debug, Error)]
pub enum BeaconError {
// A network error occurred.
/// A network error occurred.
#[error("Network error: {0}")]
Network(#[from] HttpError),
// The beacon information is not found.
/// The beacon information is not found.
#[error("Existing beacon information not found.")]
NotFound,
// The redacted event is not an error, but it's not useful for the client.
/// The redacted event is not an error, but it's not useful for the client.
#[error("Beacon event is redacted and cannot be processed.")]
Redacted,
// The client must join the room to access the beacon information.
/// The client must join the room to access the beacon information.
#[error("Must join the room to access beacon information.")]
Stripped,
// The beacon event could not be deserialized.
/// The beacon event could not be deserialized.
#[error("Deserialization error: {0}")]
Deserialization(#[from] serde_json::Error),
// The beacon event is expired.
/// The beacon event is expired.
#[error("The beacon event has expired.")]
NotLive,
// Allow for other errors to be wrapped.
/// Allow for other errors to be wrapped.
#[error("Other error: {0}")]
Other(Box<Error>),
}
+2 -2
View File
@@ -76,8 +76,8 @@ pub use client::{
sanitize_server_name,
};
pub use error::{
Error, HttpError, HttpResult, NotificationSettingsError, RefreshTokenError, Result,
RumaApiError,
BeaconError, Error, HttpError, HttpResult, NotificationSettingsError, RefreshTokenError,
Result, RumaApiError,
};
pub use http_client::TransmissionProgress;
#[cfg(all(feature = "e2e-encryption", feature = "sqlite"))]