SolidWallOfCode commented on code in PR #10112:
URL: https://github.com/apache/trafficserver/pull/10112#discussion_r1279397515
##########
mgmt/rpc/jsonrpc/json/YAMLCodec.h:
##########
@@ -174,41 +174,31 @@ class yamlcpp_json_encoder
{
///
/// @brief Function to encode an error.
- /// Error could be from two sources, presence of @c std::error_code means a
high level and the @c ts::Errata a callee . Both will
- /// be written into the passed @c out YAML::Emitter. This is mainly a
convenience class for the other two encode_* functions.
+ /// Error could be from two sources, presence of @c std::error_code means a
high level and the @c swoc::Errata a callee . Both
+ /// will be written into the passed @c out YAML::Emitter. This is mainly a
convenience class for the other two encode_* functions.
///
/// @param error std::error_code High level, main error.
/// @param errata the Errata from the callee
/// @param json output parameter. YAML::Emitter.
///
static void
- encode_error(std::error_code error, ts::Errata const &errata, YAML::Emitter
&json)
+ encode_error(swoc::Errata const &errata, YAML::Emitter &json)
{
json << YAML::Key << "error";
json << YAML::BeginMap;
- json << YAML::Key << "code" << YAML::Value << error.value();
- json << YAML::Key << "message" << YAML::Value << error.message();
- if (!errata.isOK()) {
+ json << YAML::Key << "code" << YAML::Value << errata.code().value();
+ json << YAML::Key << "message" << YAML::Value << errata.code().message();
+ if (!errata.is_ok()) {
json << YAML::Key << "data";
json << YAML::BeginSeq;
for (auto const &err : errata) {
- json << YAML::BeginMap;
- json << YAML::Key << "code" << YAML::Value << err.getCode();
- json << YAML::Key << "message" << YAML::Value << err.text();
- json << YAML::EndMap;
+ json << YAML::Value << std::string(err.text()); // FIXME!! Shouldn't
need a @c std::string
Review Comment:
Hmmm. @bneradt made me take that out and overall I agree. We should also
think about tracking the severity.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]