83 std::chrono::system_clock::time_point
timestamp = std::chrono::system_clock::now();
98 return status >= 400 && status < 500;
108 return status >= 500 && status < 600;
205 const std::string& request_id =
"") ->
http_error;
Builder for HTTP error responses.
static auto build_json_error(const http_error &error) -> http_response
Build JSON format error response (RFC 7807)
static auto build_html_error(const http_error &error) -> http_response
Build HTML format error response.
static auto make_error(http_error_code code, const std::string &detail="", const std::string &request_id="") -> http_error
Create http_error from error code.
auto get_error_status_text(http_error_code code) -> std::string_view
Get status text for HTTP error code.
http_error_code
Standard HTTP error codes (RFC 7231)
@ unavailable_for_legal_reasons
@ proxy_authentication_required
@ request_header_fields_too_large
@ variant_also_negotiates
@ network_authentication_required
@ http_version_not_supported
parse_error_type
Types of HTTP parsing errors.
@ error
Black hole detected, reset to base.
Structured HTTP error information.
auto status_code() const -> int
Get status code as integer.
auto is_client_error() const -> bool
Check if this is a client error (4xx)
std::chrono::system_clock::time_point timestamp
auto is_server_error() const -> bool
Check if this is a server error (5xx)
Represents an HTTP response message.
Detailed HTTP parsing error information.
auto to_http_error() const -> http_error
Convert parse error to http_error.
parse_error_type error_type