Add a message only constructor to CURLException.
This commit is contained in:
parent
a9e918ba6a
commit
1263b03999
|
@ -55,6 +55,13 @@ public:
|
||||||
explicit CURLException(const CURLcode &error, string message,
|
explicit CURLException(const CURLcode &error, string message,
|
||||||
string error_buffer);
|
string error_buffer);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Constructor with message.
|
||||||
|
*
|
||||||
|
* @since 0.1.0
|
||||||
|
*/
|
||||||
|
explicit CURLException(string message);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief The error code returned by libcurl.
|
* @brief The error code returned by libcurl.
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,10 +36,19 @@ CURLException::CURLException(const CURLcode &error, string message,
|
||||||
, _error_buffer{move(error_buffer)}
|
, _error_buffer{move(error_buffer)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
CURLException::CURLException(string message)
|
||||||
|
: error_code{CURLE_OK}
|
||||||
|
, _message{move(message)}
|
||||||
|
{}
|
||||||
|
|
||||||
const char *CURLException::what() const noexcept
|
const char *CURLException::what() const noexcept
|
||||||
{
|
{
|
||||||
static string error_string{"libCURL error: " + to_string(error_code)
|
static string error_string{"libCURL error: "};
|
||||||
+ " - " + _message};
|
if (error_code != CURLE_OK)
|
||||||
|
{
|
||||||
|
error_string += to_string(error_code) + " - ";
|
||||||
|
}
|
||||||
|
error_string += _message;
|
||||||
if (!_error_buffer.empty())
|
if (!_error_buffer.empty())
|
||||||
{
|
{
|
||||||
error_string += " [" + _error_buffer + "]";
|
error_string += " [" + _error_buffer + "]";
|
||||||
|
|
Loading…
Reference in New Issue