Closed shepmaster closed 2 years ago
This should allow us to capture a backtrace only when the underlying error didn't already capture one.
General idea:
trait GenerateImplicitData { fn generate() -> Self; // Existing fn fn generate_with_source(e: &dyn Error) -> Self { Self::generate() // default impl delegates to existing fn } }
This should allow us to be semver compatible. Would we want to combine this to one function with Option<&dyn Error> in a breaking change later?
Option<&dyn Error>
Then we'd implement it for backtrace like...
impl GenerateImplicitData for Option<Backtrace> { fn generate() { todo!("...") } fn generate_with_source(e: &dyn Error) -> Self { // appropriate checks for feature enabled if e.request_ref::<Backtrace>().is_none() { Self::generate() // delegates to existing fn } } }
Should we create another type that bakes the Option in?
Option
This should allow us to capture a backtrace only when the underlying error didn't already capture one.
General idea:
This should allow us to be semver compatible. Would we want to combine this to one function with
Option<&dyn Error>
in a breaking change later?Then we'd implement it for backtrace like...
Should we create another type that bakes the
Option
in?