Report error objects
This commit is contained in:
parent
28473e489f
commit
12417d8f5e
|
@ -278,7 +278,8 @@ nlohmann::json MastodonClient::_send_request(std::optional<std::string> 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<std::string>());
|
||||
const nlohmann::json& error = j.at("error");
|
||||
throw MastodonException(response_code, error.is_string() ? error.get<std::string>() : error.dump());
|
||||
}
|
||||
|
||||
if (redis && cache_key) {
|
||||
|
|
Loading…
Reference in New Issue