Skip to content

Commit 0909a26

Browse files
authored
Better error logging when /create RPC fails (#6689)
1 parent e34e1f9 commit 0909a26

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/node/node_state.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,16 +1975,18 @@ namespace ccf
19751975
}
19761976

19771977
const auto status = ctx->get_response_status();
1978+
const auto& raw_body = ctx->get_response_body();
19781979
if (status != HTTP_STATUS_OK)
19791980
{
19801981
LOG_FAIL_FMT(
1981-
"Create response is error: {} {}",
1982+
"Create response is error: {} {}\n{}",
19821983
status,
1983-
ccf::http_status_str((ccf::http_status)status));
1984+
ccf::http_status_str((ccf::http_status)status),
1985+
std::string(raw_body.begin(), raw_body.end()));
19841986
return false;
19851987
}
19861988

1987-
const auto body = nlohmann::json::parse(ctx->get_response_body());
1989+
const auto body = nlohmann::json::parse(raw_body);
19881990
if (!body.is_boolean())
19891991
{
19901992
LOG_FAIL_FMT("Expected boolean body in create response");

src/node/rpc/node_frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ namespace ccf
14841484
.install();
14851485

14861486
auto create = [this](auto& ctx, nlohmann::json&& params) {
1487-
LOG_DEBUG_FMT("Processing create RPC");
1487+
LOG_INFO_FMT("Processing create RPC");
14881488

14891489
bool recovering = node_operation.is_reading_public_ledger();
14901490

0 commit comments

Comments
 (0)