diff --git a/Cargo.lock b/Cargo.lock index 7cfae5077..a61e49a84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1648,6 +1648,7 @@ dependencies = [ "rustls", "self_cell", "serde", + "serde-error", "serde_json", "serde_test", "smallvec", @@ -3415,9 +3416,9 @@ dependencies = [ [[package]] name = "serde-error" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e988182713aeed6a619a88bca186f6d6407483485ffe44c869ee264f8eabd13f" +checksum = "342110fb7a5d801060c885da03bf91bfa7c7ca936deafcc64bb6706375605d47" dependencies = [ "serde", ] diff --git a/Cargo.toml b/Cargo.toml index a9f32edcf..4054d56f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ redb_v1 = { package = "redb", version = "1.5.1", optional = true } reflink-copy = { version = "0.1.8", optional = true } self_cell = "1.0.1" serde = { version = "1", features = ["derive"] } +serde-error = "0.1.3" smallvec = { version = "1.10.0", features = ["serde", "const_new"] } tempfile = { version = "3.10.0", optional = true } thiserror = "1" @@ -102,7 +103,7 @@ unused-async = "warn" [profile.dev-ci] inherits = 'dev' -opt-level = 1 +opt-level = 1 [profile.optimized-release] inherits = 'release' diff --git a/src/downloader.rs b/src/downloader.rs index ee8952550..90f3cd0b5 100644 --- a/src/downloader.rs +++ b/src/downloader.rs @@ -796,9 +796,9 @@ impl, D: Dialer> Service { if let Some(sender) = handlers.on_progress { self.progress_tracker.unsubscribe(&kind, &sender); sender - .send(DownloadProgress::Abort( - anyhow::Error::from(DownloadError::Cancelled).into(), - )) + .send(DownloadProgress::Abort(serde_error::Error::new( + &*anyhow::Error::from(DownloadError::Cancelled), + ))) .await .ok(); } diff --git a/src/export.rs b/src/export.rs index 38008251b..3576edf1d 100644 --- a/src/export.rs +++ b/src/export.rs @@ -4,7 +4,6 @@ use std::path::PathBuf; use anyhow::Context; use bytes::Bytes; -use iroh_base::rpc::RpcError; use serde::{Deserialize, Serialize}; use tracing::trace; @@ -124,7 +123,7 @@ pub enum ExportProgress { /// We are done with the whole operation. AllDone, /// We got an error and need to abort. - Abort(RpcError), + Abort(serde_error::Error), } fn pathbuf_from_name(name: &str) -> PathBuf { diff --git a/src/get/db.rs b/src/get/db.rs index 7682188f0..769dd57da 100644 --- a/src/get/db.rs +++ b/src/get/db.rs @@ -9,7 +9,7 @@ use genawaiter::{ rc::{Co, Gen}, GeneratorState, }; -use iroh_base::{hash::Hash, rpc::RpcError}; +use iroh_base::hash::Hash; use iroh_io::AsyncSliceReader; use iroh_net::endpoint::Connection; use serde::{Deserialize, Serialize}; @@ -669,7 +669,7 @@ pub enum DownloadProgress { /// We got an error and need to abort. /// /// This will be the last message in the stream. - Abort(RpcError), + Abort(serde_error::Error), } /// The id of a blob in a transfer diff --git a/src/provider.rs b/src/provider.rs index 1ffc8bff4..44cb793ff 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -7,7 +7,6 @@ use bao_tree::io::{ EncodeError, }; use futures_lite::future::Boxed as BoxFuture; -use iroh_base::rpc::RpcError; use iroh_io::{ stats::{SliceReaderStats, StreamWriterStats, TrackingSliceReader, TrackingStreamWriter}, AsyncSliceReader, AsyncStreamWriter, TokioStreamWriter, @@ -157,7 +156,7 @@ pub enum AddProgress { /// We got an error and need to abort. /// /// This will be the last message in the stream. - Abort(RpcError), + Abort(serde_error::Error), } /// Progress updates for the batch add operation. @@ -181,7 +180,7 @@ pub enum BatchAddPathProgress { /// We got an error and need to abort. /// /// This will be the last message in the stream. - Abort(RpcError), + Abort(serde_error::Error), } /// Read the request from the getter. diff --git a/src/store/traits.rs b/src/store/traits.rs index 174772d38..e7982ebbd 100644 --- a/src/store/traits.rs +++ b/src/store/traits.rs @@ -9,7 +9,6 @@ use bao_tree::{ use bytes::Bytes; use futures_lite::{Stream, StreamExt}; use genawaiter::rc::{Co, Gen}; -use iroh_base::rpc::RpcError; use iroh_io::AsyncSliceReader; pub use range_collections; use serde::{Deserialize, Serialize}; @@ -877,7 +876,7 @@ pub enum ConsistencyCheckProgress { /// Consistency check ended Done, /// We got an error and need to abort. - Abort(RpcError), + Abort(serde_error::Error), } /// Progress updates for the validate operation @@ -947,7 +946,7 @@ pub enum ValidateProgress { /// We are done with the whole operation. AllDone, /// We got an error and need to abort. - Abort(RpcError), + Abort(serde_error::Error), } /// Database events