Skip to content

Commit

Permalink
Merge 38d99c9 into 3a16b28
Browse files Browse the repository at this point in the history
  • Loading branch information
peuter committed Jun 21, 2018
2 parents 3a16b28 + 38d99c9 commit 7b9d923
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 115 deletions.
14 changes: 13 additions & 1 deletion client/source/class/cv/io/Client.js
Expand Up @@ -90,6 +90,10 @@ qx.Class.define('cv.io.Client', {
statics: {
CLIENTS: [],
TEST_MODE: false,
ERROR_CODES: {
CONNECTION: 1,
PROTOCOL_MISSING_VERSION: 10
},

/**
* Stop all running clients
Expand Down Expand Up @@ -645,7 +649,15 @@ qx.Class.define('cv.io.Client', {
* @param type {String} type of event to record
* @param data {Object} data to record
*/
record: function(type, data) {} // jshint ignore:line
record: function(type, data) {}, // jshint ignore:line

/**
* Can be overridden to provide an error handler for client errors
* @param type {Number} one of cv.io.Client.ERROR_CODES
* @param message {String} detailed error message
* @param args
*/
showError: function(type, message, args) {} // jshint ignore:line
},

/*
Expand Down
17 changes: 11 additions & 6 deletions client/source/class/cv/io/transport/LongPolling.js
Expand Up @@ -62,13 +62,18 @@ qx.Class.define('cv.io.transport.LongPolling', {
handleSession: function (args, connect) {
var json = this.client.getResponse(args);
this.sessionId = json.s;
this.version = json.v.split('.', 3);
if (!json.hasOwnProperty('v')) {
this.error('CometVisu protocol error: missing protocol version');
this.client.showError(cv.io.Client.ERROR_CODES.PROTOCOL_MISSING_VERSION, json);
} else {
this.version = json.v.split('.', 3);

if (0 < parseInt(this.version[0]) || 1 < parseInt(this.version[1])) {
this.error('ERROR CometVisu Client: too new protocol version (' + json.v + ') used!');
}
if (connect) {
this.connect();
if (0 < parseInt(this.version[0]) || 1 < parseInt(this.version[1])) {
this.error('ERROR CometVisu Client: too new protocol version (' + json.v + ') used!');
}
if (connect) {
this.connect();
}
}
},

Expand Down
25 changes: 25 additions & 0 deletions source/class/cv/TemplateEngine.js
Expand Up @@ -242,6 +242,7 @@ qx.Class.define('cv.TemplateEngine', {
if (cv.Config.reporting) {
this.visu.record = qx.lang.Function.curry(cv.report.Record.getInstance().record, cv.report.Record.BACKEND).bind(cv.report.Record.getInstance());
}
this.visu.showError = this._handleClientError.bind(this);
this.visu.user = 'demo_user'; // example for setting a user

// show connection state in NotificationCenter
Expand All @@ -266,6 +267,30 @@ qx.Class.define('cv.TemplateEngine', {
}, this);
},

_handleClientError: function (errorCode, varargs) {
varargs = qx.lang.Array.fromArguments(arguments, 1);
var notification;
switch (errorCode) {
case cv.io.Client.ERROR_CODES.PROTOCOL_MISSING_VERSION:
notification = {
topic: "cv.error",
title: qx.locale.Manager.tr('CometVisu protocol error'),
message: qx.locale.Manager.tr('The backend did send an invalid response to the %1Login%2 request: missing protocol version.',
'<a href="https://github.com/CometVisu/CometVisu/wiki/Protocol#Login" target="_blank">',
'</a>') + '<br/>' +
qx.locale.Manager.tr('Please try to fix the problem in the backend.') +
'<br/><br/><strong>' + qx.locale.Manager.tr('Backend-Response:') + '</strong><pre>' + JSON.stringify(varargs[0], null, 2) +'</pre></div>',
severity: "urgent",
unique: true,
deletable: false
};
break;
}
if (notification) {
cv.core.notifications.Router.dispatchMessage(notification.topic, notification);
}
},

/**
* Reset some values related to the current page
*/
Expand Down
140 changes: 80 additions & 60 deletions source/translation/de.po
Expand Up @@ -11,117 +11,137 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: cv/Application.js:175
#: cv/Application.js:187
msgid "Please describe what you have done until the error occured?"
msgstr ""
"Bitte beschreiben, was Sie gemacht haben bis der Fehler aufgetreten ist."

#: cv/Application.js:207
#: cv/Application.js:220
msgid "An error occured"
msgstr "Ein Fehler ist aufgetreten"

#: cv/Application.js:214
#: cv/Application.js:227
msgid "Reload"
msgstr "Neu laden"

#: cv/Application.js:241
#: cv/Application.js:254
msgid "Please do not forget to attach the downloaded Logfile to this ticket."
msgstr ""
"Bitte vergessen Sie nicht, die heruntergeladenen Log-Datei an dieses Ticket "
"zu hängen."

#: cv/Application.js:248
#: cv/Application.js:261
msgid "Enable reporting on reload"
msgstr "Neu laden mit aktivierter Aufzeichnung"

#: cv/Application.js:253
#: cv/Application.js:266
msgid "Report Bug"
msgstr "Fehler berichten"

#: cv/Application.js:561
msgid "Config-File Error!"
msgstr "Fehler in Konfigurations-Datei!"

#: cv/Application.js:565
msgid "Invalid config file!"
msgstr "Ungültige Konfigurations-Datei!"

#: cv/Application.js:565
msgid "Please check!"
msgstr "Bitte prüfen!"

#: cv/Application.js:573
msgid "Config file has wrong library version!"
msgstr "Konfigurations-Datei hat die falsche 'library' Version"

#: cv/Application.js:574
msgid "This can cause problems with your configuration"
msgstr "Das kann Probleme in Ihrer Konfiguration verursachen"

#: cv/Application.js:575
msgid "You can run the %1Configuration Upgrader%2."
msgstr "Sie können den %1Konfigurations-Upgrader%2 laufen lassen."

#: cv/Application.js:576
msgid ""
"Or you can start without upgrading %1with possible configuration problems%2"
msgstr ""
"Oder Sie starten ohne Upgrade %1mit möglichen Konfigurations-Problemen%2"

#: cv/Application.js:579
msgid ""
"404: Config file not found. Neither as normal config (%1) nor as demo config"
" (%2)."
msgstr ""
"404: Konfigurations-Datei nicht gefunden. Weder als normale Konfiguration "
"(%1) noch als Demo-Konfiguration (%2)"

#: cv/Application.js:582
msgid "Unhandled error of type \"%1\""
msgstr "Unbekannter Fehler vom Typ \"%1\""

#: cv/TemplateEngine.js:245
#: cv/TemplateEngine.js:252
msgid "Connection error"
msgstr "Verbindungsfehler"

#: cv/TemplateEngine.js:254
#: cv/TemplateEngine.js:261
msgid "Error requesting %1: %2 - %3."
msgstr "Fehler beim Laden von %1: %2 - %3."

#: cv/TemplateEngine.js:256
#: cv/TemplateEngine.js:263
msgid "Connection to backend is lost."
msgstr "Verbindung zum Backend verloren."

#: cv/plugins/openhab/Settings.js:173
#: cv/TemplateEngine.js:277
msgid "CometVisu protocol error"
msgstr "CometVisu Protokollfehler"

#: cv/TemplateEngine.js:278
msgid ""
"The backend did send an invalid response to the %1Login%2 request: missing "
"protocol version."
msgstr ""
"Das Backend hat eine ungültige Antwort auf die %1Login%2-Anfrage geschickt: "
"Fehlende Protokollversion."

#: cv/TemplateEngine.js:281
msgid "Please try to fix the problem in the backend."
msgstr "Bitte versuchen Sie das Problem im Backend zu lösen."

#: cv/TemplateEngine.js:282
msgid "Backend-Response:"
msgstr "Antwort des Backends:"

#: cv/plugins/openhab/Settings.js:174
msgid ""
"The CometVisu seems to be delivered by a proxied webserver. Changing "
"configuration values might not have the expected effect. Please proceed only"
" if you know what you are doing."
msgstr ""
"Die CometVisu scheint über einen Proxy ausgeliefert zu werden. Änderungen "
"an den Einstellungen könnten deshalb nicht den gewünschten Effekt habe."
"Bitte führen Sie daher nur Änderungen durch, wenn Sie wissen was Sie tun."
"Die CometVisu scheint über einen Proxy ausgeliefert zu werden. Änderungen an"
" den Einstellungen könnten deshalb nicht den gewünschten Effekt habe.Bitte "
"führen Sie daher nur Änderungen durch, wenn Sie wissen was Sie tun."

#: cv/plugins/openhab/Settings.js:211
#: cv/plugins/openhab/Settings.js:212
msgid "openHAB backend settings"
msgstr "openHAB Backend Einstellungen"

#: cv/plugins/openhab/Settings.js:226
#: cv/plugins/openhab/Settings.js:227
msgid "Cancel"
msgstr "Abbruch"

#: cv/plugins/openhab/Settings.js:231
#: cv/plugins/openhab/Settings.js:232
msgid "Save"
msgstr "Speichern"

#: cv/ui/NotificationCenter.js:257
#: cv/ui/NotificationCenter.js:227
msgid "Delete all"
msgstr "Alle löschen"

#: cv/ui/NotificationCenter.js:257
#: cv/ui/NotificationCenter.js:227
msgid "Message center"
msgstr "Nachrichtenzentrale"

#: cv/ui/structure/pure/Unknown.js:88
msgid "unknown: %1"
msgstr "Unbekannt: %1"

#: cv/util/ConfigLoader.js:170
msgid "Config-File Error!"
msgstr "Fehler in Konfigurations-Datei!"

#: cv/util/ConfigLoader.js:174
msgid "Invalid config file!"
msgstr "Ungültige Konfigurations-Datei!"

#: cv/util/ConfigLoader.js:174
msgid "Please check!"
msgstr "Bitte prüfen!"

#: cv/util/ConfigLoader.js:182
msgid "Config file has wrong library version!"
msgstr "Konfigurations-Datei hat die falsche 'library' Version"

#: cv/util/ConfigLoader.js:183
msgid "This can cause problems with your configuration"
msgstr "Das kann Probleme in Ihrer Konfiguration verursachen"

#: cv/util/ConfigLoader.js:184
msgid "You can run the %1Configuration Upgrader%2."
msgstr "Sie können den %1Konfigurations-Upgrader%2 laufen lassen."

#: cv/util/ConfigLoader.js:185
msgid ""
"Or you can start without upgrading %1with possible configuration problems%2"
msgstr ""
"Oder Sie starten ohne Upgrade %1mit möglichen Konfigurations-Problemen%2"

#: cv/util/ConfigLoader.js:188
msgid ""
"404: Config file not found. Neither as normal config (%1) nor as demo config"
" (%2)."
msgstr ""
"404: Konfigurations-Datei nicht gefunden. Weder als normale Konfiguration "
"(%1) noch als Demo-Konfiguration (%2)"

#: cv/util/ConfigLoader.js:191
msgid "Unhandled error of type \"%1\""
msgstr "Unbekannter Fehler vom Typ \"%1\""

0 comments on commit 7b9d923

Please sign in to comment.