dtolnay/anyhow

Make Error::from_std public

stepancheg opened this issue · 0 comments

Make Error::from_std(impl StdError, Option<Backtrace>) public so a user can control whether capture backtrace or not.

Alternatively, Error may have constructors with an option to capture backtrace, like:

impl Error {
  pub fn with_backtrace(impl StdError) { ... }
  pub fn without_backtrace(impl StdError) { ... }
}

These are useful for:

  • tests of error handling, like what is printed exactly
  • make some errors cheaper or more detailed regardless of global setup