#error #context

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

#1924 in Rust patterns

Download history 116/week @ 2023-10-17 105/week @ 2023-10-24 112/week @ 2023-10-31 110/week @ 2023-11-07 76/week @ 2023-11-14 123/week @ 2023-11-21 98/week @ 2023-11-28 101/week @ 2023-12-05 79/week @ 2023-12-12 77/week @ 2023-12-19 67/week @ 2023-12-26 64/week @ 2024-01-02 94/week @ 2024-01-09 67/week @ 2024-01-16 44/week @ 2024-01-23 53/week @ 2024-01-30

276 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