pornsieve  0.0.0
Search porn sites and filter the results using regular expressions
Public Member Functions | Public Attributes | List of all members
pornsieve::HTTPException Class Reference

Exception for HTTP errors. More...

#include <exceptions.hpp>

Inheritance diagram for pornsieve::HTTPException:
Inheritance graph
[legend]
Collaboration diagram for pornsieve::HTTPException:
Collaboration graph
[legend]

Public Member Functions

 HTTPException (const uint16_t code)
 Constructor with error code. More...
 
 HTTPException (const uint16_t code, string_view error_message)
 Constructor with error code and error message. More...
 
const char * what () const noexcept override
 Returns error message. More...
 

Public Attributes

const uint16_t error_code
 HTTP status code. More...
 

Detailed Description

Exception for HTTP errors.

Since
0.1.0

Constructor & Destructor Documentation

◆ HTTPException() [1/2]

pornsieve::HTTPException::HTTPException ( const uint16_t  code)
inlineexplicit

Constructor with error code.

Since
0.1.0
93  : error_code{code}
94  {}

◆ HTTPException() [2/2]

pornsieve::HTTPException::HTTPException ( const uint16_t  code,
string_view  error_message 
)
inlineexplicit

Constructor with error code and error message.

Since
0.1.0
102  : error_code{code}
103  , _error_message{error_message}
104  {}

Member Function Documentation

◆ what()

const char * pornsieve::HTTPException::what ( ) const
overridenoexcept

Returns error message.

Since
0.1.0
45 {
46  static string error_string;
47  error_string = _error_message;
48  if (!error_string.empty())
49  {
50  error_string = " – " + error_string;
51  }
52  error_string = format("HTTP error: {:d}{:s}", error_code, error_string);
53  return error_string.c_str();
54 }

Member Data Documentation

◆ error_code

const uint16_t pornsieve::HTTPException::error_code

HTTP status code.


The documentation for this class was generated from the following files:
pornsieve::HTTPException::error_code
const uint16_t error_code
HTTP status code.
Definition: exceptions.hpp:106