From 3a71a14f569cae2e9e6a7febeb737bd9fe36409b Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 9 Feb 2021 17:07:10 +0100 Subject: [PATCH] Make error message of CURLException public. --- src/curl_wrapper.cpp | 2 +- src/curl_wrapper.hpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp index d233117..768922d 100644 --- a/src/curl_wrapper.cpp +++ b/src/curl_wrapper.cpp @@ -247,7 +247,7 @@ const char *CURLException::what() const noexcept // NOTE: The string has to be static, or it'll vanish before it can be // used. Couldn't find good documentation on that. static string error_string; - error_string = _error_message; + error_string = error_message; if (!error_string.empty()) { error_string = " – " + error_string; diff --git a/src/curl_wrapper.hpp b/src/curl_wrapper.hpp index 01aa825..ad1939c 100644 --- a/src/curl_wrapper.hpp +++ b/src/curl_wrapper.hpp @@ -243,10 +243,11 @@ public: */ explicit CURLException(const CURLcode code, string_view error_buffer) : error_code{code} - , _error_message{error_buffer} + , error_message{error_buffer} {} - const CURLcode error_code; //!< Error code from libcurl. + const CURLcode error_code; //!< Error code from libcurl. + const string error_message; //!< The error message. /*! * @brief Error message. @@ -254,9 +255,6 @@ public: * @since 0.1.0 */ [[nodiscard]] const char *what() const noexcept override; - -private: - string _error_message; }; } // namespace curl_wrapper