Crate http_problem

Source
Expand description

§HTTP Problem-based Error Handling Library

This crate provides a general mechanism for error handling based on the RFC 7807 problem entity with the Problem type.

Users can find many pre-defined errors at the http and sql modules.

The workflow for error handling with this library is as follow:

  1. Use the predefined errors/functions or define a new one with the define_custom_type! macro to returns errors in functions that return Result<T, Problem> (an alias is provided in the library).
  2. Catch any desired error with ProblemResultExt::catch_err.

Modules§

http
HTTP related well-known errors.
prelude
Prelude imports for this crate.
reporter
Definitions for global error reporting.

Macros§

define_custom_type
Define a new custom problem type.
ensure
Return early with an AssertionError if a condition is not satisfied.
requires
Return early with an UnprocessableEntity if a condition is not satisfied.

Structs§

Extensions
Set of extensions of a Problem.
Problem
A RFC 7807 Problem Error.

Type Aliases§

CowStr
An alias for a static Cow<str>.
Result
Convenience alias for functions that can error ouy with Problem.