diff --git a/lib/edit/editsStore.js b/lib/edit/editsStore.js index 83e1ab4..b35e68d 100644 --- a/lib/edit/editsStore.js +++ b/lib/edit/editsStore.js @@ -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() diff --git a/samples/military-offline.html b/samples/military-offline.html index df266eb..f325fd0 100644 --- a/samples/military-offline.html +++ b/samples/military-offline.html @@ -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) diff --git a/test/spec/editsStoreSpec.js b/test/spec/editsStoreSpec.js index 53c1fec..bdeb694 100644 --- a/test/spec/editsStoreSpec.js +++ b/test/spec/editsStoreSpec.js @@ -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 )