Warn about deprecated fields (#1314)

Fixes #1251.
This commit is contained in:
Sergey Kuznetsov
2024-04-11 15:23:59 +01:00
committed by GitHub
parent 230212213b
commit e744a5a8a9
64 changed files with 1902 additions and 761 deletions

View File

@@ -59,6 +59,9 @@ getWarningInfo(WarningCode code)
"'ledger_index':'current' in your request"},
{warnRPC_OUTDATED, "This server may be out of date"},
{warnRPC_RATE_LIMIT, "You are about to be rate limited"},
{warnRPC_DEPRECATED,
"Some fields from your request are deprecated. Please check the documentation at "
"https://xrpl.org/docs/references/http-websocket-apis/ and update your request."}
};
auto matchByCode = [code](auto const& info) { return info.code == code; };
@@ -73,10 +76,8 @@ makeWarning(WarningCode code)
{
auto json = boost::json::object{};
auto const& info = getWarningInfo(code);
json["id"] = code;
json["message"] = static_cast<string>(info.message);
json["message"] = info.message;
return json;
}
@@ -128,9 +129,9 @@ makeError(ClioError err, std::optional<std::string_view> customError, std::optio
boost::json::object json;
auto const& info = getErrorInfo(err);
json["error"] = customError.value_or(info.error).data();
json["error"] = customError.value_or(info.error);
json["error_code"] = static_cast<uint32_t>(info.code);
json["error_message"] = customMessage.value_or(info.message).data();
json["error_message"] = customMessage.value_or(info.message);
json["status"] = "error";
json["type"] = "response";