Go to file
Michael Pfaff 9950d96522
Improved output and API
- New and improved output format
- Adjusted context API to go along with it
- Nicer output for termination
- Better example
- Better handling of backtraces
- Removed a silly field that is never used
- `How::location` now returns the actual location instead of the context
  element
- `Location::caller` is now additionally captured for every call to
  `How::context`
- Added a feature that implements `Clone` for `How` (by deferring to the
  existing `clone_without_backtrace` method)
2023-06-29 00:00:42 -04:00
examples Improved output and API 2023-06-29 00:00:42 -04:00
src Improved output and API 2023-06-29 00:00:42 -04:00
.gitignore Where was I? 2022-07-21 20:39:47 -04:00
Cargo.toml Improved output and API 2023-06-29 00:00:42 -04:00
README.md Seems good 2022-07-21 20:40:44 -04:00

README.md

How

A seriously contextual error library that focuses on how you got there. Designed to make debugging parser logic easier, how enables you to concisely capture any and all context that could possibly have contributed to an error.

Getting started

Thanks to how's minimal set of public types whose names are all unique from those of most crates (aside from other error handling libraries), you can safely use star imports anywhere you want to use how.

use how::*;

fn main() -> Result<()> {
	Err(How::new("TODO: implement amazing new program"))
}

[How] intentionally omits a [From] implementation for [std::error::Error] to discourage the creation of [How]s with no caller context. Instead, the [Explain] trait is implemented for all Result1 and provides a convenient context function.


  1. Where E is either [How] or implements [std::error::Error]. Errors that don't implement [std::error::Error] (usually in order to be permitted to implement [From] for any type that implements [std::error::Error]) can only be, are not, and will not be, supported manually. ↩︎