Skip to content

Commit

Permalink
More logging around failed response parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
willgittoes-dd committed Feb 14, 2019
1 parent 2dcf6d4 commit 2b74f7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void AgentHttpEncoder::handleResponse(const std::string& response) {
}
sampler_->configure(config[priority_sampling_key]);
} catch (const json::parse_error&) {
std::cerr << "Unable to parse response from agent" << std::endl;
std::cerr << "Unable to parse response from agent. Response was: " << response << std::endl;
return;
}
}
Expand Down
4 changes: 3 additions & 1 deletion test/agent_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ TEST_CASE("writer") {
std::stringstream error_message;
std::streambuf* stderr = std::cerr.rdbuf(error_message.rdbuf());
writer.flush(std::chrono::seconds(10));
REQUIRE(error_message.str() == "Unable to parse response from agent\n");
REQUIRE(error_message.str() ==
("Unable to parse response from agent. Response was: "
"// What?! This isn't JSON! Everyone knows real JSON doesn't have comments...\n"));
std::cerr.rdbuf(stderr); // Restore stderr.
REQUIRE(sampler->config == "");
}
Expand Down

0 comments on commit 2b74f7e

Please sign in to comment.