Commit 7c47a33a authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Improve error message from status gadget

   In this way, the debug becomes easier to be notified.
parent e1f8358b
/*globals console, window, rJS, i18n, domsugar */
/*globals console, window, rJS, domsugar, JSON */
/*jslint indent: 2, nomen: true, maxlen: 80 */
(function (window, rJS, domsugar) {
(function (window, rJS, domsugar, JSON) {
"use strict";
var gadget_klass = rJS(window);
......@@ -338,7 +338,7 @@
.onLoop(function () {
var gadget = this;
if (gadget.state.jio_key) {
if (typeof gadget.state.jio_key === 'string' && gadget.state.jio_key !== '') {
return gadget.jio_get(gadget.state.jio_key)
.push(function (result) {
var state_dict = result.news || {};
......@@ -346,6 +346,10 @@
return gadget.changeState(state_dict);
});
}
throw new Error(
'jio_key dont contains a proper value: ' +
JSON.stringify(gadget.state.jio_key)
);
}, 300000)
.onStateChange(function () {
......@@ -360,4 +364,4 @@
return this.changeState(state_dict);
});
}(window, rJS, domsugar));
\ No newline at end of file
}(window, rJS, domsugar, JSON));
\ No newline at end of file
......@@ -278,7 +278,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.50668.64434.580</string> </value>
<value> <string>1006.58340.40727.23620</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1660581838.54</float>
<float>1680031759.77</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment