diff --git a/client.cpp b/client.cpp index 2922e60..2f395ec 100644 --- a/client.cpp +++ b/client.cpp @@ -278,7 +278,8 @@ nlohmann::json MastodonClient::_send_request(std::optional cache_ke long response_code = this->_response_status_code(); nlohmann::json j = nlohmann::json::parse(res); if (response_code != 200) { - throw MastodonException(response_code, j.at("error").get()); + const nlohmann::json& error = j.at("error"); + throw MastodonException(response_code, error.is_string() ? error.get() : error.dump()); } if (redis && cache_key) {