From a61edb1474f33d95bfd1cf036e40ac213df99446 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 19 May 2020 19:41:19 +0200 Subject: [PATCH] Throw more descriptive error on decode error We need to be able to tell this exception came from a decoder. --- common/rfb/DecodeManager.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx index 98b6e790..80c10510 100644 --- a/common/rfb/DecodeManager.cxx +++ b/common/rfb/DecodeManager.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -133,8 +134,12 @@ void DecodeManager::decodeRect(const Rect& r, int encoding, bufferStream = freeBuffers.front(); bufferStream->clear(); decoder->readRect(r, conn->getInStream(), conn->server, bufferStream); - decoder->decodeRect(r, bufferStream->data(), bufferStream->length(), - conn->server, pb); + try { + decoder->decodeRect(r, bufferStream->data(), bufferStream->length(), + conn->server, pb); + } catch (rdr::Exception& e) { + throw Exception("Error decoding rect: %s", e.str()); + } return; } -- 2.39.5