anyhow icon indicating copy to clipboard operation
anyhow copied to clipboard

Make Error::from_std public

Open stepancheg opened this issue 2 years ago • 0 comments
trafficstars

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

stepancheg avatar Mar 17 '23 18:03 stepancheg