#context #error #information #traits #wrapping #extension #type

error-context

Methods and types that help with adding additional context information to error types

3 releases

0.1.2 Aug 27, 2019
0.1.1 Apr 11, 2019
0.1.0 Feb 18, 2019

#2063 in Rust patterns

Download history 58/week @ 2024-03-14 70/week @ 2024-03-21 116/week @ 2024-03-28 114/week @ 2024-04-04 93/week @ 2024-04-11 60/week @ 2024-04-18 67/week @ 2024-04-25 71/week @ 2024-05-02 69/week @ 2024-05-09 100/week @ 2024-05-16 136/week @ 2024-05-23 78/week @ 2024-05-30 118/week @ 2024-06-06 98/week @ 2024-06-13 119/week @ 2024-06-20 100/week @ 2024-06-27

450 downloads per month
Used in 10 crates (3 directly)

MIT license

19KB
298 lines

Latest Version Documentation License

Aim of this library is to provide convenient way of adding statically typed context information to errors in Rust.

This crate provides two ways of adding context:

  • to new error types by means of WithContext trait,
  • to existing errors by wrapping in ErrorContext type and converting to your type using From trait.

It provides extension methods for Result type as well as some free functions to help with adding context.

For examples and usage see crate documentation at docs.rs.

If you are looking for more dynamic way of adding context to error messages see problem crate.

No runtime deps