[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp

Pranav Kant pranavk at collabora.co.uk
Mon May 22 05:36:13 UTC 2017


 wsd/DocumentBroker.cpp |    6 ------
 wsd/LOOLWSD.cpp        |   18 ++++++++----------
 2 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit 1ea87b627e077590c6eefa455ce3c8f7d0564068
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon May 22 11:04:26 2017 +0530

    wsd: Arrange exception handling a bit
    
    Remove incorrect usage of std::uncaught_exception and handle
    StorageConnectionException later.
    
    Change-Id: I15ecd46b51e8ed33649fe876d46ce3d5fbae07cc

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 7d807acb..73178103 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -797,12 +797,6 @@ size_t DocumentBroker::addSession(const std::shared_ptr<ClientSession>& session)
             throw std::runtime_error(msg);
         }
     }
-    catch (const StorageConnectionException& exc)
-    {
-        // Alert user about failed load
-        session->sendMessage("error: cmd=storage kind=loadfailed");
-        throw;
-    }
     catch (const StorageSpaceLowException&)
     {
         LOG_ERR("Out of storage while loading document with URI [" << session->getPublicUri().toString() << "].");
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a2e868d9..3a877242 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2129,18 +2129,16 @@ private:
                                 clientSession->sendMessage(msg);
                                 docBroker->stop();
                             }
+                            catch (const StorageConnectionException& exc)
+                            {
+                                // Alert user about failed load
+                                const std::string msg = "error: cmd=storage kind=loadfailed";
+                                clientSession->sendMessage(msg);
+                                docBroker->stop();
+                            }
                             catch (const std::exception& exc)
                             {
-                                LOG_ERR("Error while handling loading : " << exc.what());
-                                // only send our default error message if we haven't handled the
-                                // exception already up the stack
-                                if (std::uncaught_exception())
-                                {
-                                    // FIXME: Are we sure we want to say that all other failures due
-                                    // to an 'unauthorized' WOPI host ?
-                                    const std::string msg = "error: cmd=internal kind=unauthorized";
-                                    clientSession->sendMessage(msg);
-                                }
+                                LOG_ERR("Error while loading : " << exc.what());
                                 docBroker->stop();
                             }
                         });


More information about the Libreoffice-commits mailing list