fix(edit) diff: add error check

This commit is contained in:
coderaiser 2014-06-06 05:59:18 -04:00
parent 7788e6b0f7
commit 677eca4d7e

View file

@ -294,26 +294,30 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
],
url = CloudFunc.getJoinURL(libs);
DOM.load.js(url, function() {
DOM.load.js(url, function(error) {
var patch,
isAllowed = DOM.Storage.isAllowed();
if (!Diff)
Diff = new DiffProto(diff_match_patch);
Util.exec.if(!isAllowed, function() {
patch = Diff.createPatch(Value, newValue);
Util.exec(callback, patch);
}, function(func) {
var path = Info.path;
if (error) {
DOM.Dialog.alert(error);
} else {
if (!Diff)
Diff = new DiffProto(diff_match_patch);
DOM.getDataFromStorage(path, function(error, data) {
if (data)
Value = data;
Util.exec.if(!isAllowed, function() {
patch = Diff.createPatch(Value, newValue);
Util.exec(callback, patch);
}, function(func) {
var path = Info.path;
func();
DOM.getDataFromStorage(path, function(error, data) {
if (data)
Value = data;
func();
});
});
});
}
});
}