Skip to content

Commit

Permalink
Better error logging when /create RPC fails (#6689)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyashton authored Dec 6, 2024
1 parent e34e1f9 commit 0909a26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/node/node_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/node/rpc/node_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 0909a26

Please sign in to comment.