[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-4' - loleaflet/README loleaflet/src

Mihai Varga mihai.varga at collabora.com
Tue Aug 11 01:43:24 PDT 2015


 loleaflet/README                        |    4 +++-
 loleaflet/src/control/Control.Dialog.js |    9 ++++++++-
 loleaflet/src/layer/tile/TileLayer.js   |    9 ++++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 8b6c2c47b710f354f576881de5846413951fbb07
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Tue Aug 11 11:37:26 2015 +0300

    loleaflet: parse the error cmd before firing the error event

diff --git a/loleaflet/README b/loleaflet/README
index 2b35a9e..2b1c2f8 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -158,7 +158,9 @@ Writer pages:
 Error:
     - events
         map.on('error', function (e) {}) where
-            + e.msg = a message describing the error
+            + [e.msg] = a message describing the error
+            + [e.cmd] = the command that caused the error
+            + [e.kind] = the kind of error
 
 Contributing
 ------------
diff --git a/loleaflet/src/control/Control.Dialog.js b/loleaflet/src/control/Control.Dialog.js
index 98a6b48..31f9654 100644
--- a/loleaflet/src/control/Control.Dialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -9,7 +9,14 @@ L.Control.Dialog = L.Control.extend({
 	},
 
 	_onError: function (e) {
-		vex.dialog.alert(e.msg);
+		if (e.msg) {
+			vex.dialog.alert(e.msg);
+		}
+		else if (e.cmd && e.kind) {
+			var msg = 'The server encountered a \'' + e.kind + '\' error while' +
+						' parsing the \'' + e.cmd + '\' command.';
+			vex.dialog.alert(msg);
+		}
 	}
 });
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index bcda4aa..01e9e7f 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -510,7 +510,8 @@ L.TileLayer = L.GridLayer.extend({
 			this._map.fire('searchnotfound');
 		}
 		else if (textMsg.startsWith('error:')) {
-			this._map.fire('error', {msg: textMsg.substring(7)});
+			command = this._parseServerCmd(textMsg);
+			this._map.fire('error', {cmd: command.errorCmd, kind: command.errorKind});
 		}
 	},
 
@@ -579,6 +580,12 @@ L.TileLayer = L.GridLayer.extend({
 			else if (tokens[i].substring(0, 9) === 'prefetch=') {
 				command.preFetch = tokens[i].substring(9);
 			}
+			else if (tokens[i].substring(0, 4) === 'cmd=') {
+				command.errorCmd = tokens[i].substring(4);
+			}
+			else if (tokens[i].substring(0, 5) === 'kind=') {
+				command.errorKind= tokens[i].substring(5);
+			}
 		}
 		if (command.tileWidth && command.tileHeight) {
 			var scale = command.tileWidth / this.options.tileWidthTwips;


More information about the Libreoffice-commits mailing list