Skip to content
Snippets Groups Projects
Verified Commit 6eda5280 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Support error code to string conversions

parent 638d6d60
No related branches found
No related tags found
No related merge requests found
Pipeline #2135 failed
......@@ -162,7 +162,7 @@ if(USE_BUNDLED_COEURL)
FetchContent_Declare(
coeurl
GIT_REPOSITORY https://nheko.im/Nheko-Reborn/coeurl.git
GIT_TAG 3901507db25cf3f9364b58cd8c7880640900c992
GIT_TAG 3d6555e8371702a3efd5b07a0a67918f1d46e2e6
)
FetchContent_MakeAvailable(coeurl)
target_link_libraries(matrix_client PUBLIC coeurl::coeurl)
......
......@@ -122,7 +122,7 @@ mtx::http::Client::prepare_callback(HeadersCallback<Response> callback)
int err_code,
int status_code) {
Response response_data;
mtx::http::ClientError client_error;
mtx::http::ClientError client_error{};
if (err_code) {
client_error.error_code = err_code;
......
......@@ -19,6 +19,8 @@ struct ClientError
int status_code;
//! Parsing response error.
std::string parse_error;
const char *error_code_string() const;
};
} // namespace http
} // namespace mtx
#include "mtx/errors.hpp"
#include "mtxclient/http/errors.hpp"
#include <coeurl/errors.hpp>
#include <nlohmann/json.hpp>
......@@ -108,3 +111,9 @@ from_json(const nlohmann::json &obj, Error &error)
error.unauthorized = obj.get<user_interactive::Unauthorized>();
}
}
const char *
mtx::http::ClientError::error_code_string() const
{
return coeurl::to_string(static_cast<CURLcode>(error_code));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment