From 653b34cab72ab550db6d113554ba1cbf54ed91c4 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 26 Sep 2024 11:31:09 +0900 Subject: [PATCH] chore: update error derivation crates --- Cargo.toml | 2 +- src/error.rs | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 56cbf8eeb..c73136c8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ lazy_static = "1.4.0" rand = "~0.8.5" rand_chacha = "~0.3.1" rayon = "1.5.1" -err-derive = "~0.3.1" +thiserror = "1.0" num_cpus = "1.13.0" itertools = "~0.10.0" tempfile = "3.6.0" diff --git a/src/error.rs b/src/error.rs index ea143b18f..c5e4278ce 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,8 +7,8 @@ // permissions and limitations relating to use of the SAFE Network Software. use bincode::ErrorKind; -use err_derive::Error; use std::io::Error as IoError; +use thiserror::Error; /// Specialisation of `std::Result` for crate. pub type Result = std::result::Result; @@ -17,26 +17,26 @@ pub type Result = std::result::Result; #[derive(Debug, Error)] #[allow(missing_docs)] pub enum Error { - #[error(display = "An error during compression or decompression.")] + #[error("An error during compression or decompression.")] Compression, - #[error(display = "An error during initializing CBC-AES cipher instance.")] + #[error("An error during initializing CBC-AES cipher instance.")] Cipher(String), - #[error(display = "An error within the symmetric encryption process.")] + #[error("An error within the symmetric encryption process.")] Encryption, - #[error(display = "An error within the symmetric decryption process({})", _0)] + #[error("An error within the symmetric decryption process({})", _0)] Decryption(String), - #[error(display = "A generic I/O error")] - Io(#[source] IoError), - #[error(display = "Generic error({})", _0)] + #[error("A generic I/O error")] + Io(#[from] IoError), + #[error("Generic error({})", _0)] Generic(String), - #[error(display = "Serialisation error")] - Bincode(#[source] Box), - #[error(display = "deserialization")] + #[error("Serialisation error")] + Bincode(#[from] Box), + #[error("deserialization")] Deserialise, - #[error(display = "num parse error")] - NumParse(#[source] std::num::ParseIntError), - #[error(display = "Rng error")] - Rng(#[source] rand::Error), - #[error(display = "Unable to obtain lock")] + #[error("num parse error")] + NumParse(#[from] std::num::ParseIntError), + #[error("Rng error")] + Rng(#[from] rand::Error), + #[error("Unable to obtain lock")] Poison, }