mastodonpp  0.0.0
Public Member Functions | Public Attributes | List of all members
mastodonpp::CURLException Class Reference

Exception for libcurl errors. More...

#include <mastodonpp/exceptions.hpp>

Inheritance diagram for mastodonpp::CURLException:

Public Member Functions

 CURLException (const CURLcode &error, string message)
 Constructor with error code and message. More...
 
 CURLException (const CURLcode &error, string message, string error_buffer)
 Constructor with error code, message and error buffer. More...
 
const char * what () const noexcept override
 Returns the error code, message and error buffer. More...
 

Public Attributes

const CURLcode error_code
 The error code returned by libcurl. More...
 

Detailed Description

Exception for libcurl errors.

Since
0.1.0

Constructor & Destructor Documentation

◆ CURLException() [1/2]

mastodonpp::CURLException::CURLException ( const CURLcode &  error,
string  message 
)
explicit

Constructor with error code and message.

Since
0.1.0
28  : error_code{error}
29  , _message{move(message)}
30 {}

◆ CURLException() [2/2]

mastodonpp::CURLException::CURLException ( const CURLcode &  error,
string  message,
string  error_buffer 
)
explicit

Constructor with error code, message and error buffer.

Since
0.1.0
34  : error_code{error}
35  , _message{move(message)}
36  , _error_buffer{move(error_buffer)}
37 {}

Member Function Documentation

◆ what()

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

Returns the error code, message and error buffer.

Since
0.1.0
40 {
41  static string error_string{"libCURL error: " + to_string(error_code)
42  + " - " + _message};
43  if (!_error_buffer.empty())
44  {
45  error_string.append(" [" + _error_buffer + "]");
46  }
47  return error_string.c_str();
48 }

Member Data Documentation

◆ error_code

const CURLcode mastodonpp::CURLException::error_code

The error code returned by libcurl.

For more information consult libcurl-errors(3).

Since
0.1.0

The documentation for this class was generated from the following files:
mastodonpp::CURLException::error_code
const CURLcode error_code
The error code returned by libcurl.
Definition: exceptions.hpp:66