mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
trying to catch quota errors at application level... not that easy!
This commit is contained in:
parent
1161a603a4
commit
08a97f2c7b
@ -45,7 +45,7 @@ define(["esri/graphic"], function(Graphic)
|
||||
var edits = this._retrieveEditsQueue();
|
||||
edits.push(edit);
|
||||
var success = this._storeEditsQueue(edits);
|
||||
return { success: success, error: success? undefined : this.ERROR_LOCALSTORAGE_FULL };
|
||||
return { success: success, error: success? undefined : {code: -1, message:this.ERROR_LOCALSTORAGE_FULL} };
|
||||
},
|
||||
|
||||
peekFirstEdit: function()
|
||||
|
||||
@ -180,6 +180,20 @@
|
||||
layer.on('update-end', logCurrentObjectIds);
|
||||
});
|
||||
|
||||
offlineFeaturesManager.on(offlineFeaturesManager.events.EDITS_ENQUEUED, function(results)
|
||||
{
|
||||
var errors = Array.prototype.concat(
|
||||
results.addResults.filter(function(r){ return !r.success }),
|
||||
results.updateResults.filter(function(r){ return !r.success }),
|
||||
results.deleteResults.filter(function(r){ return !r.success })
|
||||
);
|
||||
|
||||
if( errors.length )
|
||||
{
|
||||
errors.map(function(e){ return e.error });
|
||||
}
|
||||
});
|
||||
|
||||
updatePendingEditsList();
|
||||
}
|
||||
catch(err)
|
||||
|
||||
@ -4,7 +4,7 @@ var KEY_PREFIX = "__LOCAL_STORAGE_TEST__";
|
||||
var EDITS_QUEUE_KEY = "esriEditsQueue";
|
||||
var REDO_STACK_KEY = "esriRedoStack";
|
||||
|
||||
var EXECUTE_LONG_TESTS = false;
|
||||
var EXECUTE_LONG_TESTS = true;
|
||||
|
||||
describe("Internal Methods", function()
|
||||
{
|
||||
@ -365,7 +365,8 @@ describe("Public Interface", function()
|
||||
// now, try to push one edit
|
||||
var result = g_editsStore.pushEdit(g_editsStore.ADD, 20, g_test.polygonFeature);
|
||||
expect(result.success).toBeFalsy();
|
||||
expect(result.error).toEqual(g_editsStore.ERROR_LOCALSTORAGE_FULL);
|
||||
expect(result.error.code).toEqual(-1);
|
||||
expect(result.error.message).toEqual(g_editsStore.ERROR_LOCALSTORAGE_FULL);
|
||||
|
||||
// clean everything
|
||||
for( var key in window.localStorage )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user