[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp loolwsd/QueueHandler.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Jan 6 06:31:06 PST 2016


 loolwsd/LOOLKit.cpp      |    6 +++++-
 loolwsd/LOOLWSD.cpp      |   31 ++++++++++++++++++++++++++-----
 loolwsd/QueueHandler.hpp |    2 --
 3 files changed, 31 insertions(+), 8 deletions(-)

New commits:
commit 7bf3fe843a62061deff2f6c2f269c6713e4861f6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Jan 6 09:13:21 2016 -0500

    loolwsd: more exception handling
    
    Change-Id: I7ac694395e2c231565bd84a7cd7813498dba387f
    Reviewed-on: https://gerrit.libreoffice.org/21163
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index d468739..6c765ab 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -432,7 +432,7 @@ public:
         }
         catch (const Exception& exc)
         {
-            Log::error() << exc.displayText()
+            Log::error() << "Error: " << exc.displayText()
                          << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                          << Log::end;
         }
@@ -440,6 +440,10 @@ public:
         {
             Log::error(std::string("Exception: ") + exc.what());
         }
+        catch (...)
+        {
+            Log::error("Unexpected Exception.");
+        }
 
         Log::debug("Thread [" + thread_name + "] finished.");
     }
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 979bbb4..2669011 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -445,7 +445,8 @@ public:
                     // FIXME: There is a race here when a request A gets in the queue and
                     // is processed _after_ a later request B, because B gets processed
                     // synchronously and A is waiting in the queue thread.
-                    // Fix is to push everything into the queue.
+                    // The fix is to push everything into the queue
+                    // (i.e. change MessageQueue to vector<char>).
                     if (singleLine)
                     {
                         const std::string firstLine = getFirstLine(data, size);
@@ -462,9 +463,19 @@ public:
             queue.put("eof");
             queueHandlerThread.join();
         }
-        catch (const IOException& exc)
+        catch (const Exception& exc)
         {
-            Log::error("IOException: " + exc.message());
+            Log::error() << "Error: " << exc.displayText()
+                         << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
+                         << Log::end;
+        }
+        catch (const std::exception& exc)
+        {
+            Log::error(std::string("Exception: ") + exc.what());
+        }
+        catch (...)
+        {
+            Log::error("Unexpected Exception.");
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
@@ -501,9 +512,19 @@ public:
                     return session->handleInput(data, size);
                 });
         }
-        catch (const IOException& exc)
+        catch (const Exception& exc)
+        {
+            Log::error() << "Error: " << exc.displayText()
+                         << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
+                         << Log::end;
+        }
+        catch (const std::exception& exc)
+        {
+            Log::error(std::string("Exception: ") + exc.what());
+        }
+        catch (...)
         {
-            Log::error("IOException: " + exc.message());
+            Log::error("Unexpected Exception.");
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
diff --git a/loolwsd/QueueHandler.hpp b/loolwsd/QueueHandler.hpp
index 5111382..759c175 100644
--- a/loolwsd/QueueHandler.hpp
+++ b/loolwsd/QueueHandler.hpp
@@ -48,12 +48,10 @@ public:
         catch (const std::exception& exc)
         {
             Log::error(std::string("Exception: ") + exc.what());
-            raise(SIGABRT);
         }
         catch (...)
         {
             Log::error("Unexpected Exception.");
-            raise(SIGABRT);
         }
 
         Log::debug("Thread [" + _name + "] finished.");


More information about the Libreoffice-commits mailing list