Added support for "errors" in addition to "error". #12
All checks were successful
the build was successful
All checks were successful
the build was successful
This commit is contained in:
parent
e86019f41f
commit
f84a272f53
|
@ -69,7 +69,7 @@ void Easy::Entity::from_string(const string &json)
|
|||
ttdebug << "ERROR: JSON string holds no object\n";
|
||||
ttdebug << "String was: " << json << '\n';
|
||||
}
|
||||
else if (!_tree["error"].isNull())
|
||||
else if (!_tree["error"].isNull() || !_tree["errors"].isNull())
|
||||
{
|
||||
ttdebug << "ERROR: Server returned an error\n";
|
||||
ttdebug << "String was: " << json << '\n';
|
||||
|
@ -107,7 +107,14 @@ bool Easy::Entity::check_valid(const std::vector<string> &attributes) const
|
|||
|
||||
const string Easy::Entity::error() const
|
||||
{
|
||||
return get_string("error");
|
||||
string error = get_string("error");
|
||||
if (error.empty())
|
||||
{
|
||||
// Pleroma uses {"errors":{"detail":"[…]"}} sometimes.
|
||||
const Json::Value node = get("errors.detail");
|
||||
error = node.asString();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
bool Easy::Entity::was_set() const
|
||||
|
|
Reference in New Issue
Block a user