error-stack: Something like #[from]
in thiserror? (and include thiserro
functionality with error-stack
)
#804
Replies: 1 comment 1 reply
-
Hi @dpc!
That is one of the main reasons we have written
A functionality to return the current context by value is planned. This is currently not implemented as a plain
This will not happen unless someone comes up with a solution on how to implement
These two libraries serve two different purposes. |
Beta Was this translation helpful? Give feedback.
-
I understand that this crate tracks the chains of errors internally, so I don't have to wrap one error in another like I usually would.
However. It is kind of useful sometimes to be able to do that.
Eg. I have:
It is useful to that that validation error right there, and not have to do downcastings etc. to get it.
Even when using
thiserror
to derive things onRequestError
, I can't just add#[from]
because the function returningWebHookValidationError
is now going to returnReport<WebHookValidationError>
.I guess I can still just use
std::result::Result
forWebHookValidationResult
, but that only works for cases where I don't care about usingerror-stack
for it for some reason.I hope it makes sense. Not a big deal, but might be something to think about. Maybe
Report<C>
couldimpl Into<C>
or something like that.And possibly
error-stack
just come up with it's ownbuild-in
thiserror
-like macros. This way#[from]
macro could just implementFrom<Report<E>>
along the `From.BTW. Having to combine these two (thiserror + error-stack) and documentation treating interactions between them kind of implicitly is already a steep learning curve. And it's also just an additional
cargo add ...
to run. IMO, just for this reason it would make sense to have it build-in, which woulderror-stack
completely standalone solution.Beta Was this translation helpful? Give feedback.
All reactions