toobad
Want better error handling? Well, toobad.
toobad is a simple, unbloated error handling library for Rust.
[]
= "0.1"
The Basics
Any error type automatically converts into toobad::Error via ?:
use Result;
Adding Context
Wrap any Result or Option with a human-readable message:
use ;
Prints as:
failed to read config file: No such file or directory (os error 2)
Works on Option too:
let value = some_map.get.context?;
Creating Errors from Scratch
Use the toobad!() macro with full format!() support:
use toobad;
return Err;
Or bail early with bail!():
use bail;
bail!;
// equivalent to: return Err(toobad!(...))
Or assert conditions with ensure!():
use ensure;
ensure!;
// equivalent to: if !condition { bail!(...) }
Downcasting
Recover the original error type when you need it:
if let Some = error.
License
This project is licensed under either of MIT License or [Apache License, Version 2.0](LICENSE-APACHE at your option.
Cheers, RazkarStudio © 2026 RazkarStudio. All rights reserved