|
|
|
|
|
by shepmaster
547 days ago
|
|
Without deeply looking into it, I'd expect that to integrate with SNAFU, you could basically write something like this: struct SpanTraceWrapper(tracing_error::SpanTrace);
impl snafu::GenerateImplicitData for SpanTraceWrapper {
fn generate() -> Self {
Self(tracing_error::SpanTrace::capture())
}
}
And then you can use it as #[derive(Debug, Snafu)]
struct SomeError {
#[snafu(implicit)]
span_trace: SpanTraceWrapper,
}
This will capture the `SpanTrace` whenever `SomeError` is constructed (e.g. `thing().context(SomeSnafu)` or `SomeSnafu.fail()`. |
|