more specific From<ErrorKind>
This commit is contained in:
parent
5da492cc7e
commit
6fa9a0d37d
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ctxerr"
|
name = "ctxerr"
|
||||||
version = "0.2.5"
|
version = "0.2.6"
|
||||||
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
||||||
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
||||||
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
||||||
@ -15,5 +15,5 @@ resolver = "2"
|
|||||||
members = ["derive"]
|
members = ["derive"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ctxerr_derive = {version = "0.5.1", path = "derive"}
|
ctxerr_derive = {version = "0.5.2", path = "derive"}
|
||||||
thiserror = "1.0.40"
|
thiserror = "1.0.40"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ctxerr_derive"
|
name = "ctxerr_derive"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
||||||
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
||||||
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
||||||
|
@ -74,12 +74,12 @@ pub fn ctxerr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Into<ErrorKind>> From<T> for #base_name {
|
impl From<ErrorKind> for #base_name {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn from(val: T) -> Self {
|
fn from(kind: ErrorKind) -> Self {
|
||||||
let b = std::backtrace::Backtrace::capture();
|
let b = std::backtrace::Backtrace::capture();
|
||||||
Self{
|
Self{
|
||||||
kind: val.into(),
|
kind,
|
||||||
backtrace: Some(std::backtrace::Backtrace::capture()),
|
backtrace: Some(std::backtrace::Backtrace::capture()),
|
||||||
location: Some(core::panic::Location::caller()),
|
location: Some(core::panic::Location::caller()),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user