Skip to content
  • Marijn Suijten's avatar
    examples: Return `anyhow::Result` out of `main()` · ce98a475
    Marijn Suijten authored
    It is annoying to see only a single line of error when debugging a chain
    of (e.g. `anyhow::Context::context()`-created) errors, and have a
    zero exit-code while at it.
    
    Instead Rust supports returning a `Result` type straight from main which
    is `Debug`- instead of `Display`-printed, so that - in the case of
    `anyhow::Error` - all nested (via `.source()`) `Error`s are printed in
    backtrace-like form, and the exit code is appropriately non-zero.
    
    Part-of: <!1336>
    ce98a475