This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 256089b527fdafa03811fc9f9b68f261484fef7a Author: Damian Meden <[email protected]> AuthorDate: Wed Mar 20 10:31:44 2024 +0100 CID1508922 - Fix Uncaught exception. (#11166) (cherry picked from commit 4681638c043a23834cec85a2d55a0cddd071881f) --- include/mgmt/rpc/jsonrpc/json/YAMLCodec.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h b/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h index ce8eb5a7e4..cc29dfe2dd 100644 --- a/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h +++ b/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h @@ -50,12 +50,13 @@ class yamlcpp_json_decoder decode_and_validate(YAML::Node const &node) noexcept { specs::RPCRequestInfo request; - if (!node.IsDefined() || (node.Type() != YAML::NodeType::Map) || (node.size() == 0)) { - // We only care about structures with elements. - return {request, error::RPCErrorCode::INVALID_REQUEST}; - } try { + if (!node.IsDefined() || (node.Type() != YAML::NodeType::Map) || (node.size() == 0)) { + // We only care about structures with elements. + return {request, error::RPCErrorCode::INVALID_REQUEST}; + } + // try the id first so we can use for a possible error. // All this may be obsolete if we decided to accept only strings. if (auto id = node["id"]) {
