From a8362bd087a16ee67a523bb0167ba1c4a62e91de Mon Sep 17 00:00:00 2001 From: John Date: Fri, 28 Jun 2024 18:11:40 +0200 Subject: [PATCH] keep generated decode output and append it to error prefix on error --- src/ebusd/mainloop.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index c867563b..14a8a087 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -382,10 +382,15 @@ void MainLoop::run() { scanRetry = 0; // restart scan counting } if (!req->isHttp() && (ostream.tellp() == 0 || result != RESULT_OK)) { - if (reqMode.listenMode != lm_direct) { - ostream.str(""); + string suffix; + if (result == RESULT_EMPTY && ostream.tellp() > 0) { + suffix = ostream.str(); } + ostream.str(""); ostream << getResultCode(result); + if (!suffix.empty()) { + ostream << " " << suffix; + } } const auto resp = ostream.str(); req->log(&resp);