rustc panics
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
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;
|
||||
@@ -476,7 +478,7 @@ pub fn todoval<T>() -> T {
|
||||
todo!("TODO todoval\n{bt:?}")
|
||||
}
|
||||
|
||||
pub trait ToPublicError: std::error::Error {
|
||||
pub trait ToPublicError: std::error::Error + Send {
|
||||
fn to_public_error(&self) -> String;
|
||||
}
|
||||
|
||||
@@ -546,6 +548,19 @@ mod test {
|
||||
assert_eq!(s, "SomeErrorEnumB0::FromA(SomeErrorEnumA::BadCase)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_handle_b0_user_00() {
|
||||
use thiserror::UserErrorClass;
|
||||
use thiserror::UserErrorInfo;
|
||||
let e = failing_b0_00().unwrap_err();
|
||||
let s = e.class();
|
||||
if let UserErrorClass::Unspecified = s {
|
||||
()
|
||||
} else {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_handle_b1_00() {
|
||||
let e = failing_b1_00().unwrap_err();
|
||||
|
||||
Reference in New Issue
Block a user