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