candle icon indicating copy to clipboard operation
candle copied to clipboard

Improve `candle_core::Error` to make it more ergonomic

Open EricLBuehler opened this issue 1 year ago • 0 comments

Currently, our Error type is already useful but could benefit from some of the QoL features which the anyhow crate has.

This PR adds the following:

  • Make Error::msg more in line with anyhow::Error::msg. Although the type bound changes, this is not a breaking change because std::error::Error: Display already.
  • Add the Context trait. Inspired by anyhow's Context trait which allows for .with_context and .context on Options and Results. Very useful!

EricLBuehler avatar Sep 10 '24 23:09 EricLBuehler