Add missing error messages

pull/1/head
yflory 4 years ago
parent fcfcb3dca6
commit d17265f2eb

@ -2505,6 +2505,9 @@ define([
} else if (err.type === 'ERESTRICTED') { } else if (err.type === 'ERESTRICTED') {
msg = Messages.restrictedError; msg = Messages.restrictedError;
if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); } if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); }
} else if (err.type === 'HASH_NOT_FOUND' && priv.isHistoryVersion) {
msg = Messages.oo_deletedVersion;
if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); }
} }
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
sframeChan.event('EV_SHARE_OPEN', {hidden: true}); sframeChan.event('EV_SHARE_OPEN', {hidden: true});
@ -3407,6 +3410,7 @@ define([
}); });
make(val, function (err) { make(val, function (err) {
clearTimeout(to); clearTimeout(to);
$input.val('');
if (err) { if (err) {
return void UI.alert(Messages.snapshots_cantMake); return void UI.alert(Messages.snapshots_cantMake);
} }

@ -340,6 +340,7 @@ define([
if (!val) { return true; } if (!val) { return true; }
config.makeSnapshot(val, function (err) { config.makeSnapshot(val, function (err) {
if (err) { return; } if (err) { return; }
$input.val('');
UI.log(Messages.saved); UI.log(Messages.saved);
}, { }, {
hash: getVersion(), hash: getVersion(),

@ -1470,6 +1470,11 @@ define([
Store.getPadMetadata(null, { Store.getPadMetadata(null, {
channel: data.channel channel: data.channel
}, waitFor(function (md) { }, waitFor(function (md) {
if (md && md.rejected) {
postMessage(clientId, "PAD_ERROR", {type: "ERESTRICTED"});
waitFor.abort();
return;
}
validateKey = md.validateKey; validateKey = md.validateKey;
})); }));
}).nThen(function () { }).nThen(function () {
@ -1482,6 +1487,11 @@ define([
postMessage(clientId, "PAD_ERROR", obj.error); postMessage(clientId, "PAD_ERROR", obj.error);
return; return;
} }
var msgs = obj.messages || [];
if (msgs.length && msgs[msgs.length - 1].serverHash !== data.versionHash) {
postMessage(clientId, "PAD_ERROR", {type: "HASH_NOT_FOUND"});
return;
}
postMessage(clientId, "PAD_CONNECT", { postMessage(clientId, "PAD_CONNECT", {
myID: fakeNetflux, myID: fakeNetflux,
id: data.channel, id: data.channel,

@ -407,6 +407,7 @@ define([
}; };
var sent = config.setLastMetadata(md); var sent = config.setLastMetadata(md);
if (!sent) { return void UI.alert(Messages.snapshots_cantMake); } if (!sent) { return void UI.alert(Messages.snapshots_cantMake); }
$input.val('');
refreshBar(); refreshBar();
} catch (e) { } catch (e) {
console.error(e); console.error(e);

Loading…
Cancel
Save