#http-api #error #api-error #http #api #7807

http-problem

A HTTP APIs focused error handling library

4 releases (2 breaking)

0.3.0 May 11, 2023
0.2.1 Oct 18, 2022
0.2.0 Aug 24, 2022
0.1.0 Aug 24, 2022

#21 in #api-error

MIT/Apache

66KB
1.5K SLoC

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.

Dependencies

~5–17MB
~251K SLoC