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

Detailed HTTP parsing error information. More...

#include <http_error.h>

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

Public Member Functions

auto to_http_error () const -> http_error
 Convert parse error to http_error.
 

Public Attributes

parse_error_type error_type = parse_error_type::malformed_request
 
size_t line_number = 0
 
size_t column_number = 0
 
std::string context
 
std::string message
 

Detailed Description

Detailed HTTP parsing error information.

Structure

  • error_type: Type of parsing error
  • line_number: Line where error occurred (1-based)
  • column_number: Column where error occurred (1-based)
  • context: Relevant portion of the malformed request
  • message: Human-readable error message

Definition at line 140 of file http_error.h.

Member Function Documentation

◆ to_http_error()

auto kcenon::network::internal::parse_error::to_http_error ( ) const -> http_error
inline

Convert parse error to http_error.

Returns
Corresponding HTTP error

Definition at line 152 of file http_error.h.

153 {
154 http_error err;
156 err.message = "Bad Request";
157 err.detail = message;
158 if (!context.empty())
159 {
160 err.detail += " near: " + context;
161 }
162 return err;
163 }

References kcenon::network::internal::bad_request, kcenon::network::internal::http_error::code, context, kcenon::network::internal::http_error::detail, kcenon::network::internal::http_error::message, and message.

Member Data Documentation

◆ column_number

size_t kcenon::network::internal::parse_error::column_number = 0

Definition at line 144 of file http_error.h.

◆ context

std::string kcenon::network::internal::parse_error::context

Definition at line 145 of file http_error.h.

Referenced by to_http_error().

◆ error_type

parse_error_type kcenon::network::internal::parse_error::error_type = parse_error_type::malformed_request

Definition at line 142 of file http_error.h.

◆ line_number

size_t kcenon::network::internal::parse_error::line_number = 0

Definition at line 143 of file http_error.h.

◆ message

std::string kcenon::network::internal::parse_error::message

Definition at line 146 of file http_error.h.

Referenced by to_http_error().


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