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

Exception for libcurl errors. More...

#include <exceptions.hpp>

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

Public Member Functions

 CURLException (const CURLcode code)
 Constructor with error code. More...
 
 CURLException (const CURLcode code, string_view error_buffer)
 Constructor with error code and error message. More...
 
const char * what () const noexcept override
 Error message. More...
 

Public Attributes

const CURLcode error_code
 Error code from libcurl. More...
 
const string error_message
 The error message. More...
 

Detailed Description

Exception for libcurl errors.

Since
0.1.0

Constructor & Destructor Documentation

◆ CURLException() [1/2]

pornsieve::CURLException::CURLException ( const CURLcode  code)
inlineexplicit

Constructor with error code.

Since
0.1.0
54  : error_code{code}
55  {}

◆ CURLException() [2/2]

pornsieve::CURLException::CURLException ( const CURLcode  code,
string_view  error_buffer 
)
inlineexplicit

Constructor with error code and error message.

Since
0.1.0
63  : error_code{code}
64  , error_message{error_buffer}
65  {}

Member Function Documentation

◆ what()

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

Error message.

Since
0.1.0
31 {
32  // NOTE: The string has to be static, or it'll vanish before it can be
33  // used. Couldn't find good documentation on that.
34  static string error_string;
35  error_string = error_message;
36  if (!error_string.empty())
37  {
38  error_string = " – " + error_string;
39  }
40  format("libcurl error: {:d}{:s}", error_code, error_string);
41  return error_string.c_str();
42 }

Member Data Documentation

◆ error_code

const CURLcode pornsieve::CURLException::error_code

Error code from libcurl.

◆ error_message

const string pornsieve::CURLException::error_message

The error message.


The documentation for this class was generated from the following files:
pornsieve::CURLException::error_message
const string error_message
The error message.
Definition: exceptions.hpp:68
pornsieve::CURLException::error_code
const CURLcode error_code
Error code from libcurl.
Definition: exceptions.hpp:67