Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::internal::http_error Struct Reference

Structured HTTP error information. More...

#include <http_error.h>

Collaboration diagram for kcenon::network::internal::http_error:
Collaboration graph

Public Member Functions

auto status_code () const -> int
 Get status code as integer.
 
auto is_client_error () const -> bool
 Check if this is a client error (4xx)
 
auto is_server_error () const -> bool
 Check if this is a server error (5xx)
 

Public Attributes

http_error_code code = http_error_code::internal_server_error
 
std::string message
 
std::string detail
 
std::string request_id
 
std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now()
 

Detailed Description

Structured HTTP error information.

Structure

  • code: HTTP error code
  • message: Short error message
  • detail: Detailed description (safe for clients)
  • request_id: Request identifier for tracing
  • timestamp: When the error occurred

Definition at line 77 of file http_error.h.

Member Function Documentation

◆ is_client_error()

auto kcenon::network::internal::http_error::is_client_error ( ) const -> bool
inline

Check if this is a client error (4xx)

Returns
true if client error

Definition at line 95 of file http_error.h.

96 {
97 int status = status_code();
98 return status >= 400 && status < 500;
99 }
auto status_code() const -> int
Get status code as integer.
Definition http_error.h:89

References status_code().

Here is the call graph for this function:

◆ is_server_error()

auto kcenon::network::internal::http_error::is_server_error ( ) const -> bool
inline

Check if this is a server error (5xx)

Returns
true if server error

Definition at line 105 of file http_error.h.

106 {
107 int status = status_code();
108 return status >= 500 && status < 600;
109 }

References status_code().

Here is the call graph for this function:

◆ status_code()

auto kcenon::network::internal::http_error::status_code ( ) const -> int
inline

Get status code as integer.

Returns
HTTP status code

Definition at line 89 of file http_error.h.

89{ return static_cast<int>(code); }

References code.

Referenced by is_client_error(), and is_server_error().

Here is the caller graph for this function:

Member Data Documentation

◆ code

◆ detail

std::string kcenon::network::internal::http_error::detail

Definition at line 81 of file http_error.h.

Referenced by kcenon::network::internal::parse_error::to_http_error().

◆ message

std::string kcenon::network::internal::http_error::message

Definition at line 80 of file http_error.h.

Referenced by kcenon::network::internal::parse_error::to_http_error().

◆ request_id

std::string kcenon::network::internal::http_error::request_id

Definition at line 82 of file http_error.h.

◆ timestamp

std::chrono::system_clock::time_point kcenon::network::internal::http_error::timestamp = std::chrono::system_clock::now()

Definition at line 83 of file http_error.h.


The documentation for this struct was generated from the following file: