#error #create #macro #own #description #error-kind #stackable-traceable

etrace

This library provides some structs and macros to create stackable/traceable errors for your own custom errors

5 releases (3 stable)

Uses old Rust 2015

1.1.1 Sep 12, 2018
1.1.0 Sep 9, 2018
1.0.0 Aug 12, 2018
0.2.8 Jun 1, 2018
0.2.7 Apr 5, 2018

#134 in #own

Download history 1874/week @ 2023-12-03 2003/week @ 2023-12-10 1755/week @ 2023-12-17 917/week @ 2023-12-24 1142/week @ 2023-12-31 1827/week @ 2024-01-07 2092/week @ 2024-01-14 1783/week @ 2024-01-21 2420/week @ 2024-01-28 2213/week @ 2024-02-04 2765/week @ 2024-02-11 2584/week @ 2024-02-18 2465/week @ 2024-02-25 1998/week @ 2024-03-03 2298/week @ 2024-03-10 2126/week @ 2024-03-17

8,970 downloads per month
Used in crypto_proto

BSD-2-Clause OR MIT

12KB
146 lines

License License

About

This library provides some structs and macros to create stackable/traceable errors for your own custom error-kinds.

The main goal of this library is to provide a flexible way to create and handle error-traces without relying on a huge codebase. Since error handling is used everywhere in a project, it's usually pretty hard to change it afterwards. This library wants to adress this problem by being as simple as possible so that if you want to switch away you don't have a fuckload of dependent code that you'd need replace.

Features

We provide some macros to create and "throw/rethrow" an error with a custom kind T and optionally a custom description and/or a previous Error<T> (even for different types of T).

Additionally we provide macros to evaluate an expression (try_err!, try_err_from!, ok_or!, some_or!, ...) to either convert the resulting error into your Error<T> or to include the resulting error as sub-error into a new Error<T>.

Build Library and Documentation

To build and open the documentation, go into the projects root-directory and run cargo doc --open.

To build the library, go into the projects root-directory and run cargo build --release; you can find the build in target/release.

No runtime deps