From 05722d9b1100f55b918cbcd5688d1294102558d9 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 29 Oct 2015 17:15:20 -0700 Subject: [PATCH] Added error handling --- platform/entanglement/bundle.json | 3 ++- platform/entanglement/src/actions/CopyAction.js | 9 +++++---- platform/entanglement/src/services/CopyService.js | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platform/entanglement/bundle.json b/platform/entanglement/bundle.json index f8eed70030..192a132602 100644 --- a/platform/entanglement/bundle.json +++ b/platform/entanglement/bundle.json @@ -20,7 +20,8 @@ "glyph": "+", "category": "contextual", "implementation": "actions/CopyAction.js", - "depends": ["locationService", "copyService", "dialogService", "notificationService"] + "depends": ["$log", "locationService", "copyService", + "dialogService", "notificationService"] }, { "key": "link", diff --git a/platform/entanglement/src/actions/CopyAction.js b/platform/entanglement/src/actions/CopyAction.js index ad8f41a323..1fb8a29229 100644 --- a/platform/entanglement/src/actions/CopyAction.js +++ b/platform/entanglement/src/actions/CopyAction.js @@ -34,9 +34,10 @@ define( * @constructor * @memberof platform/entanglement */ - function CopyAction(locationService, copyService, dialogService, notificationService, context) { + function CopyAction($log, locationService, copyService, dialogService, notificationService, context) { this.dialogService = dialogService; this.notificationService = notificationService; + this.$log = $log; AbstractComposeAction.call(this, locationService, copyService, context, "Duplicate", "to a location"); } @@ -75,9 +76,9 @@ define( AbstractComposeAction.prototype.perform.call(this, progress) .then(function(){ self.notificationService.info("Copying complete."); - }, - function (error){ - //log error + }) + .catch(function (error){ + self.$log.error("Error copying objects. ", error); //Show more general error message self.notificationService.notify({ title: "Error copying objects.", diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index dbf25fbf97..ee22f592c1 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -122,7 +122,9 @@ define( } /** - * Will persist a list of {@link objectClones}. + * Will persist a list of {@link objectClones}. It will persist all + * simultaneously, irrespective of order in the list. This may + * result in automatic request batching by the browser. * @private * @param progress * @returns {Function} a function that will perform the persistence