Skip to content

error-stack: thiserror #[derive(Context)] #746

Answered by TimDiekmann
dpc asked this question in Q&A
Discussion options

You must be logged in to vote

We thought about this as well but decided that currently, it's not helpful to copy thiserror.

Unless you want to implement Context::provide(), or you are in no-std there is no reason to not use thiserrors macro. For the former case, we couldn't come up with a good solution to implement provide(), for the latter case I expect this to be solved in the near future when Error is moved to core.

Do you have a concrete suggestion on implementing Context with provide()?

I can think of a macro that is able to attach objects similar to tracing::instrument, but we didn't decide on a syntax, yet, as attachments have no key/value pair like instrument. Suggestions are very welcome! 🙂


Marking this as t…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dpc
Comment options

@TimDiekmann
Comment options

@dpc
Comment options

@Alfred-Mountfield
Comment options

@dpc
Comment options

Answer selected by TimDiekmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area)
3 participants