]> source.dussan.org Git - tigervnc.git/commitdiff
Throw more descriptive error on decode error
authorPierre Ossman <ossman@cendio.se>
Tue, 19 May 2020 17:41:19 +0000 (19:41 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 21 May 2020 09:34:22 +0000 (11:34 +0200)
We need to be able to tell this exception came from a decoder.

common/rfb/DecodeManager.cxx

index 98b6e790401d2c6c3263f8e9ace3ce2ad87ef5e3..80c105103de143db32a5de28094b812e0b42347f 100644 (file)
@@ -22,6 +22,7 @@
 #include <rfb/CConnection.h>
 #include <rfb/DecodeManager.h>
 #include <rfb/Decoder.h>
+#include <rfb/Exception.h>
 #include <rfb/Region.h>
 
 #include <rfb/LogWriter.h>
@@ -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;
   }