Skip to content

Commit 2e6db90

Browse files
fix(core): make tauri::Error sync again (#8777)
* fix(core): make `tauri::Error` sync again closes #8754 * add unit test --------- Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 19fb5f0 commit 2e6db90

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

.changes/tauri-error-sync.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri': 'patch:bug'
3+
---
4+
5+
Fix regression in `tauri::Error` not being `Sync`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri': 'patch:breaking'
3+
---
4+
5+
Require `ScopeObject::Error` to be `Sync` as well.

core/tauri/src/error.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,17 @@ pub enum Error {
147147
UnstableFeatureNotSupported,
148148
/// Failed to deserialize scope object.
149149
#[error("error deserializing scope: {0}")]
150-
CannotDeserializeScope(Box<dyn std::error::Error + Send>),
150+
CannotDeserializeScope(Box<dyn std::error::Error + Send + Sync>),
151151
}
152152

153153
/// `Result<T, ::tauri::Error>`
154154
pub type Result<T> = std::result::Result<T, Error>;
155+
156+
#[cfg(test)]
157+
mod tests {
158+
#[test]
159+
fn error_is_send_sync() {
160+
crate::test_utils::assert_send::<super::Error>();
161+
crate::test_utils::assert_sync::<super::Error>();
162+
}
163+
}

core/tauri/src/ipc/authority.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ pub struct ScopeManager {
363363
/// though this is useful if you need to do some initialization logic on the type itself.
364364
pub trait ScopeObject: Sized + Send + Sync + Debug + 'static {
365365
/// The error type.
366-
type Error: std::error::Error + Send;
366+
type Error: std::error::Error + Send + Sync;
367367
/// Deserialize the raw scope value.
368368
fn deserialize<R: Runtime>(app: &AppHandle<R>, raw: Value) -> Result<Self, Self::Error>;
369369
}

0 commit comments

Comments
 (0)