From 9724e04e6e98b8f6d99608c766d9cb2ce9887f6d Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 4 Mar 2024 23:23:14 -0800 Subject: [PATCH] Improve CLI error handling when showing non-existent bond --- service/OneService.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/service/OneService.cpp b/service/OneService.cpp index b41abb602..866ed7282 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1663,6 +1663,7 @@ public: ZT_PeerList *pl = _node->peers(); if (pl) { + bool foundBond = false; auto id = req.matches[1]; auto out = json::object(); uint64_t wantp = Utils::hexStrToU64(id.str().c_str()); @@ -1672,12 +1673,18 @@ public: if (bond) { _peerToJson(out,&(pl->peers[i]),bond,(_tcpFallbackTunnel != (TcpConnection *)0)); setContent(req, res, out.dump()); + foundBond = true; } else { setContent(req, res, ""); res.status = 400; } + break; } } + if (!foundBond) { + setContent(req, res, ""); + res.status = 400; + } } _node->freeQueryResult((void *)pl); };