9 releases (breaking)

0.8.1 Apr 1, 2024
0.7.0 Mar 27, 2024
0.5.0 Oct 16, 2023
0.3.0 May 30, 2023

#784 in Rust patterns

Download history 23/week @ 2024-02-16 40/week @ 2024-02-23 6/week @ 2024-03-01 1/week @ 2024-03-08 143/week @ 2024-03-22 689/week @ 2024-03-29 417/week @ 2024-04-05 202/week @ 2024-04-12 5/week @ 2024-04-19 14/week @ 2024-04-26 6/week @ 2024-05-03

296 downloads per month
Used in 2 crates

MIT license

53KB
1.5K SLoC

bigerror 🍅🍆🥒

Errors should be composed of reusable parts to make readability consistent.

example

What if handling an error also produces an error?

code:

https://github.com/knox-networks/bigerror/blob/51686e4e42397f4275335a54286210e705ab8ea7/src/lib.rs#L822-L838

command (try it yourself):

$ cargo test -- test::error_in_error_handling --nocapture

output:

image

extra

If just is installed: just printerr-all to visualize all unit test errors

-- This error crate is intended to
-- enhance error-stack:
-- https://hash.dev/blog/announcing-error-stack
-- error-stack `is_fantastic && does_things.in(|_a| functional(approach))` but
-- `error_stack::Report::change_context` can make code noisy when used often
--
-- ...so why not auto implement a bunch of `From<Error> for MyError`?
-- and provide fundamental building blocks such as `bigerror::NotFound`
-- to express common causes for errors and imply correlation?
CREATE CRATE IF NOT EXISTS
  bigerror (
    error BIGERROR NOT NULL,
);

Dependencies

~0.9–3MB
~54K SLoC