[Libreoffice-commits] online.git: kit/Kit.cpp loleaflet/dist loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 16 06:26:22 UTC 2017


 kit/Kit.cpp                     |    6 ++++++
 loleaflet/dist/errormessages.js |    1 +
 loleaflet/src/core/Socket.js    |    3 +++
 3 files changed, 10 insertions(+)

New commits:
commit 6b3d2bd7cea9f4c966b523ca806b0fce1aed88dc
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jan 15 22:50:08 2017 -0500

    wsd: notify the user when document loading fails
    
    Also do not segfault in the event.
    
    Change-Id: I80c4c5c0d1d5f1a4cde9a6a3458f69a3df9dc647
    Reviewed-on: https://gerrit.libreoffice.org/33140
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index f28978e..b82cdc8 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1426,6 +1426,12 @@ private:
     /// Return access to the lok::Document instance.
     std::shared_ptr<lok::Document> getLOKitDocument() override
     {
+        if (!_loKitDocument)
+        {
+            LOG_ERR("Document [" << _docKey << "] is not loaded.");
+            throw std::runtime_error("Document " + _docKey + " is not loaded.");
+        }
+
         return _loKitDocument;
     }
 
diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index 83b6674..329fa55 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -6,6 +6,7 @@ exports.unauthorized = _('Unauthorized WOPI host. Please try again later and rep
 exports.wrongwopisrc = _('Wrong WOPISrc, usage: WOPISrc=valid encoded URI, or file_path, usage: file_path=/path/to/doc/');
 exports.sessionexpiry = _('Your session will expire in %time. Please save your work and refresh the session (or webpage) to continue.');
 exports.sessionexpired = _('Your session has been expired. Further changes to document might not be saved. Please refresh the session (or webpage) to continue.');
+exports.faileddocloading = _('Failed to load the document. Please ensure the file type is supported and not corrupted, and try again.');
 
 exports.storage = {
 	savediskfull: _('Save failed due to no disk space left on storage server. Document will now be read-only. Please contact the server administrator to continue editing.'),
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 9ba1ec5..32ed572 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -349,6 +349,9 @@ L.Socket = L.Class.extend({
 			} else if (errorKind.startsWith('wrongpassword')) {
 				passwordNeeded = true;
 				msg = _('Wrong password provided. Please try again.');
+			} else if (errorKind.startsWith('faileddocloading')) {
+				this._map._fatal = true;
+				this._map.fire('error', {msg: errorMessages.faileddocloading});
 			}
 
 			if (passwordNeeded) {


More information about the Libreoffice-commits mailing list