Skip to content

Feature Request: Integration with TracingError #479

@dignifiedquire

Description

@dignifiedquire

When using tracing in a larger application using tracing-error is quite helpful. It woul be great to have an option to allow capturing a tracing_error::SpanTrace similar to how backtrace capturing works, as part of the generated macro.

I'd be happy to write up a PR, but wanted to get some feedback on this first

#[derive(Debug, Snafu)]
pub enum CoolError {
     A {
       bactrace: Option<Backtrace>,
       // Auto detected
       span_trace: SpanTrace,
     }
     B {
       #[snafu(span_trace)] // manual annotation
       my_cool_span_trace: SpanTrace,
     }
}


// Access through sth like extending the ErrorsCompat trait
pub trait ErrorsCompat {
  // make the dependency fully dependent on the feature flag
  #[cfg(feature = "tracing-error")]
  fn span_trace(&self) -> Option<&SpanTrace> {
    None
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions