more specific From<ErrorKind>

This commit is contained in:
Andrey Tkachenko 2023-04-06 13:12:46 +04:00
parent 5da492cc7e
commit 6fa9a0d37d
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "ctxerr"
version = "0.2.5"
version = "0.2.6"
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
repository = "https://github.com/andreytkachenko/ctxerr.git"
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
@ -15,5 +15,5 @@ resolver = "2"
members = ["derive"]
[dependencies]
ctxerr_derive = {version = "0.5.1", path = "derive"}
ctxerr_derive = {version = "0.5.2", path = "derive"}
thiserror = "1.0.40"

View File

@ -1,6 +1,6 @@
[package]
name = "ctxerr_derive"
version = "0.5.1"
version = "0.5.2"
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
repository = "https://github.com/andreytkachenko/ctxerr.git"
keywords = ["error", "handling", "thiserror", "context", "backtrace"]

View File

@ -74,12 +74,12 @@ pub fn ctxerr(
}
}
impl<T: Into<ErrorKind>> From<T> for #base_name {
impl From<ErrorKind> for #base_name {
#[track_caller]
fn from(val: T) -> Self {
fn from(kind: ErrorKind) -> Self {
let b = std::backtrace::Backtrace::capture();
Self{
kind: val.into(),
kind,
backtrace: Some(std::backtrace::Backtrace::capture()),
location: Some(core::panic::Location::caller()),
}