Commit f6fc6cd1 authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs_ooffice: improve error notification for OnlyOffice gadget

parent 90827af3
...@@ -234,8 +234,10 @@ if (Common === undefined) { ...@@ -234,8 +234,10 @@ if (Common === undefined) {
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
console.log('begin render'); console.log('begin render');
var g = this, var g = this,
magic,
queue = new RSVP.Queue(); queue = new RSVP.Queue();
return queue
.push(function () {
var magic;
g.props.jio_key = options.jio_key; g.props.jio_key = options.jio_key;
g.props.key = options.key || "text_content"; g.props.key = options.key || "text_content";
g.props.value = options.value; g.props.value = options.value;
...@@ -244,8 +246,8 @@ if (Common === undefined) { ...@@ -244,8 +246,8 @@ if (Common === undefined) {
} }
if (g.props.value) { if (g.props.value) {
if (g.props.value.slice === undefined) { if (g.props.value.slice === undefined) {
display_error(g, "not suported type of document value: " + throw "not suported type of document value: " +
typeof g.props.value); typeof g.props.value;
} }
magic = g.props.value.slice(0, 5); magic = g.props.value.slice(0, 5);
if (magic === "data:") { if (magic === "data:") {
...@@ -266,19 +268,19 @@ if (Common === undefined) { ...@@ -266,19 +268,19 @@ if (Common === undefined) {
g.props.value_zip_storage.getAttachment('/', 'body.txt') g.props.value_zip_storage.getAttachment('/', 'body.txt')
.then(undefined, function (error) { .then(undefined, function (error) {
if (error.status_code === 404) { if (error.status_code === 404) {
display_error(g, 'not supported format: "' + g.props.value + '"'); throw 'not supported format: "' + g.props.value + '"';
} }
display_error(g, error); throw error;
}); });
break; break;
default: default:
display_error(g, 'not supported format: "' + g.props.value + '"'); throw 'not supported format: "' + g.props.value + '"';
} }
} }
if (!g.props.value_zip_storage) { if (!g.props.value_zip_storage) {
g.props.value_zip_storage = jIO.createJIO({type: "zipfile"}); g.props.value_zip_storage = jIO.createJIO({type: "zipfile"});
} }
return queue })
.push(function () { .push(function () {
return g.getSetting('portal_type'); return g.getSetting('portal_type');
}) })
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.60305.14946.31726</string> </value> <value> <string>956.7363.64405.13704</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481636304.19</float> <float>1482402560.96</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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