From 60c042a9725d3bdac3f72353393d151f55048ff7 Mon Sep 17 00:00:00 2001 From: Dominik Werder Date: Mon, 26 May 2025 10:36:13 +0200 Subject: [PATCH] Remove old thiserror --- Cargo.toml | 9 +++------ src/lib.rs | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4e0db40..08b7e3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "daqbuf-err" -version = "0.0.6" +version = "0.0.7" authors = ["Dominik Werder "] -edition = "2021" +edition = "2024" [lib] doctest = false @@ -18,8 +18,5 @@ chrono = { version = "0.4.26", features = ["serde"] } url = { version = "2.5.3", default-features = false } regex = "1.9.1" http = "1.0.0" -thiserror = "=0.0.1" anyhow = "1.0" - -[patch.crates-io] -thiserror = { git = "https://github.com/dominikwerder/thiserror.git", branch = "cstm" } +autoerr = "0.0.3" diff --git a/src/lib.rs b/src/lib.rs index 428def4..bc7264d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,10 +12,6 @@ macro_rules! err_dbg_dis { } pub use anyhow; -pub use thiserror; -pub use thiserror::Error as ThisError; -// pub use thiserror::UserErrorClass; -// pub use thiserror::UserErrorContent; pub mod bt { pub use backtrace::Backtrace; @@ -34,19 +30,20 @@ use std::sync::PoisonError; pub type Res2 = anyhow::Result; -#[derive(Debug, ThisError)] -pub enum ErrA { - #[error("bad-A")] - Bad, -} +autoerr::create_error_v1!( + name(ErrA, "ErrA"), + enum variants { + Bad, + }, +); -#[derive(Debug, ThisError)] -pub enum ErrB { - #[error("worse-B")] - Worse, - #[error("FromArrA")] - ErrA(#[from] ErrA), -} +autoerr::create_error_v1!( + name(ErrB, "ErrB"), + enum variants { + Worse, + ErrA(#[from] ErrA), + }, +); fn f_a() -> Result { Err(ErrA::Bad)