mirror of
https://github.com/XRPLF/clio.git
synced 2026-06-04 17:26:49 +00:00
move version specifier to Build.h
This commit is contained in:
committed by
Michael Legleux
parent
af575b1bcf
commit
458fac776c
@@ -106,6 +106,14 @@ make_error(Error err)
|
||||
boost::json::object
|
||||
make_error(Status const& status)
|
||||
{
|
||||
if (status.error == ripple::rpcUNKNOWN)
|
||||
{
|
||||
return {
|
||||
{"error", status.message},
|
||||
{"type", "response"},
|
||||
{"status", "error"}};
|
||||
}
|
||||
|
||||
boost::json::object json;
|
||||
ripple::RPC::ErrorInfo const& info(
|
||||
ripple::RPC::get_error_info(status.error));
|
||||
|
||||
@@ -103,6 +103,14 @@ struct Status
|
||||
|
||||
Status(Error error_) : error(error_){};
|
||||
|
||||
// HACK. Some rippled handlers explicitly specify errors.
|
||||
// This means that we have to be able to duplicate this
|
||||
// functionality.
|
||||
Status(std::string const& message_)
|
||||
: error(ripple::rpcUNKNOWN), message(message_)
|
||||
{
|
||||
}
|
||||
|
||||
Status(Error error_, std::string message_)
|
||||
: error(error_), message(message_)
|
||||
{
|
||||
|
||||
@@ -357,7 +357,7 @@ doLedgerEntry(Context const& context)
|
||||
auto end = std::chrono::system_clock::now();
|
||||
|
||||
if (!dbResponse or dbResponse->size() == 0)
|
||||
return Status{Error::rpcOBJECT_NOT_FOUND, "entryNotFound"};
|
||||
return Status{"entryNotFound"};
|
||||
|
||||
response[JS(index)] = ripple::strHex(key);
|
||||
response[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <backend/BackendInterface.h>
|
||||
#include <etl/ETLSource.h>
|
||||
#include <etl/ReportingETL.h>
|
||||
#include <main/Build.h>
|
||||
#include <rpc/RPCHelpers.h>
|
||||
|
||||
namespace RPC {
|
||||
@@ -49,6 +50,7 @@ doServerInfo(Context const& context)
|
||||
{{"counters", "server_info"}}, context.clientIp, context.yield);
|
||||
|
||||
info[JS(load_factor)] = 1;
|
||||
info["clio_version"] = Build::getClioVersionString();
|
||||
if (serverInfoRippled && !serverInfoRippled->contains(JS(error)))
|
||||
{
|
||||
try
|
||||
@@ -57,6 +59,7 @@ doServerInfo(Context const& context)
|
||||
auto& rippledInfo = rippledResult.at(JS(info)).as_object();
|
||||
info[JS(load_factor)] = rippledInfo[JS(load_factor)];
|
||||
info[JS(validation_quorum)] = rippledInfo[JS(validation_quorum)];
|
||||
info["rippled_version"] = rippledInfo[JS(build_version)];
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user