Enhanced error handling library built on top of [error-stack][error_stack].
bigerror provides ergonomic error handling adding out of the box functionality to [error-stack][error_stack]
for common scenarios.
Key Features
- Useful context attachments - Key-value pairs, field status, type information
- see [
kv!], [ty!], [expect_field!]
- see [
- Pre-defined contexts: [
NotFound], [ParseError], [Timeout], etc. no_stdsupport: Works in embedded and constrained environments
Quick Start
use ;
// Define your error type
;
// Example with `expect_field` for optional values
Attachments
Attach contextual information to errors using various attachment types:
use ;
;
// Key-value attachments
let error = attach_kv;
// Type-value attachments
let data = vec!;
let error = attach_kv;
;
let username = Stringfrom;
assert_eq!;
let error = attach; // "username": "alice"
let username = Username;
assert_eq!;
Feature Flags
std(default) - Standard library supportbacktrace(default) - Backtrace supporttracing- Integration with the tracing ecosystemserde- Serialization supportanyhow- Compatibility with anyhoweyre- Compatibility with eyre
Pre-defined Error Contexts
Common error contexts are provided out of the box:
- [
NotFound] - Missing resources, failed lookups - [
ParseError] - Parsing and deserialization failures - [
Timeout] - Operations that exceed time limits - [
InvalidInput] - Validation and input errors - [
ConversionError] - Type conversion failures
See the [context] module for the complete list.