Neuer Error
The error that can be whatever you want (it is Mr. Neuer). In every case (hopefully). NO AI SLOP!
An error handling library designed to be:
- Useful in both libraries and applications, containing human and machine information.
- Ergonomic, low-boilerplate and comfortable, while still adhering best-practices and providing all necessary infos.
- Flexible in interfacing with other error handling libraries.
Features
- Most importantly: error messages, that are helpful for debugging. By default it uses source locations instead of backtraces, which is often easier to follow, more efficient and works without debug info.
- Discoverable, typed context getters without generic soup, type conversions and conflicts.
- Works with std and no-std, but requires a global allocator. See example.
- Compatible with non-Send/Sync environments, but also with Send/Sync environments (per feature flag).
- Out of the box source error chaining.
Why a new (German: neuer) error library?
Long story, you can view it here. TLDR: I wasn't satisfied with my previous approach and existing libraries I know. And I was inspired by a blog post to experiment myself with error handling design.
Usage
The best way to see how to use it for your use-case is to check out the examples. Nevertheless, here is a quick demo:
// In library/module:
// Provide discoverable, typed information for library users.
provided_attachments!;
// In consumer/application:
Run cargo add neuer-error to add the library to your project.
Development
If you want to contribute or have questions, feel free to open issues :) Always better to ask before investing too much effort into PRs that I won't accept.
Running all the checks is quite simple:
- Install cargo-make:
cargo install cargo-make. - Optional, but recommended: Put
search_project_root = trueinto cargo-make's user configuration, so thatcargo makecan be run from sub-folders. - From the project directory, you can run the following tasks:
- Run all checks that are done in CI:
cargo make cior justcargo make. - Format code:
cargo make format. - Check formatting:
cargo make formatting. - Run all tests via cargo test:
cargo make test. - Run clippy for all feature sets, failing on any warnings:
cargo make clippy.
- Run all checks that are done in CI:
Minimum supported Rust version (MSRV)
Currently, I am always using the latest Rust version and do not put in any effort to keep the MSRV. Please open an issue in case you need a different policy, I might consider changing the policy.
License
Licensed under the MIT license. All contributors must agree to publish under this license.