handle kinds of error message

update test case and reduce duplicate code
This commit is contained in:
zhangzifa
2019-02-08 12:40:59 +08:00
committed by Jackson Tian
parent da28515bd8
commit ae7e11733f
15 changed files with 111 additions and 145 deletions

View File

@@ -79,6 +79,9 @@ Error CoreClient::buildCoreError(const HttpResponse &response)const
error.setErrorMessage(value["Message"].asString());
error.setHost(value["HostId"].asString());
error.setRequestId(value["RequestId"].asString());
if (value["Code"].asString().empty() || value["Message"].asString().empty()) {
error.setDetail(std::string(response.body()));
}
return error;
}