From 0909a26722a4d6cddad31f563c070875b7e6321f Mon Sep 17 00:00:00 2001 From: Eddy Ashton Date: Fri, 6 Dec 2024 10:51:09 +0000 Subject: [PATCH] Better error logging when `/create` RPC fails (#6689) --- src/node/node_state.h | 8 +++++--- src/node/rpc/node_frontend.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node/node_state.h b/src/node/node_state.h index 92ef948ea41f..3a5a68cd3e7b 100644 --- a/src/node/node_state.h +++ b/src/node/node_state.h @@ -1975,16 +1975,18 @@ namespace ccf } const auto status = ctx->get_response_status(); + const auto& raw_body = ctx->get_response_body(); if (status != HTTP_STATUS_OK) { LOG_FAIL_FMT( - "Create response is error: {} {}", + "Create response is error: {} {}\n{}", status, - ccf::http_status_str((ccf::http_status)status)); + ccf::http_status_str((ccf::http_status)status), + std::string(raw_body.begin(), raw_body.end())); return false; } - const auto body = nlohmann::json::parse(ctx->get_response_body()); + const auto body = nlohmann::json::parse(raw_body); if (!body.is_boolean()) { LOG_FAIL_FMT("Expected boolean body in create response"); diff --git a/src/node/rpc/node_frontend.h b/src/node/rpc/node_frontend.h index 4165e090905f..d28dfa36bd45 100644 --- a/src/node/rpc/node_frontend.h +++ b/src/node/rpc/node_frontend.h @@ -1484,7 +1484,7 @@ namespace ccf .install(); auto create = [this](auto& ctx, nlohmann::json&& params) { - LOG_DEBUG_FMT("Processing create RPC"); + LOG_INFO_FMT("Processing create RPC"); bool recovering = node_operation.is_reading_public_ledger();