Retire old error macro

This commit is contained in:
Dominik Werder
2025-06-03 12:25:02 +02:00
parent 60c042a972
commit 6f96623322
2 changed files with 25 additions and 22 deletions

View File

@@ -19,4 +19,4 @@ url = { version = "2.5.3", default-features = false }
regex = "1.9.1"
http = "1.0.0"
anyhow = "1.0"
autoerr = "0.0.3"
autoerr = "0.0"

View File

@@ -506,30 +506,32 @@ pub trait ToPublicError: std::error::Error + Send {
#[cfg(test)]
mod test {
use super::*;
#![allow(unused)]
// use super::Serialize;
#[derive(Debug, ThisError, Serialize, Deserialize)]
#[cstm(name = "SomeErrorEnumA")]
enum SomeErrorEnumA {
BadCase,
WithStringContent(String),
// #[error("bad: {0}")]
WithStringContentFmt(String),
}
autoerr::create_error_v1!(
name(SomeErrorEnumA, "SomeErrorEnumA"),
enum variants {
BadCase,
WithStringContent(String),
WithStringContentFmt(String),
},
);
#[derive(Debug, ThisError, Serialize, Deserialize)]
#[cstm(name = "SomeErrorEnumB0")]
enum SomeErrorEnumB0 {
FromA(#[from] SomeErrorEnumA),
}
autoerr::create_error_v1!(
name(SomeErrorEnumB0, "SomeErrorEnumB0"),
enum variants {
FromA(#[from] SomeErrorEnumA),
},
);
#[derive(Debug, ThisError, Serialize, Deserialize)]
#[cstm(name = "SomeErrorEnumB1")]
enum SomeErrorEnumB1 {
FromA(#[from] SomeErrorEnumA),
#[error("caffe")]
Caffe(SomeErrorEnumA),
}
autoerr::create_error_v1!(
name(SomeErrorEnumB1, "SomeErrorEnumB1"),
enum variants {
FromA(#[from] SomeErrorEnumA),
Caffe(SomeErrorEnumA),
},
);
fn failing_a_00() -> Result<(), SomeErrorEnumA> {
Err(SomeErrorEnumA::BadCase)
@@ -576,6 +578,7 @@ mod test {
assert_eq!(s, "SomeErrorEnumB0::FromA(SomeErrorEnumA::BadCase)");
}
#[cfg(target_abi = "x32")]
#[test]
fn error_handle_b0_user_00() {
use thiserror::UserErrorClass;