Added error handling

This commit is contained in:
Henry 2015-10-29 17:15:20 -07:00
parent 92a3fa3e4c
commit 05722d9b11
3 changed files with 10 additions and 6 deletions

View File

@ -20,7 +20,8 @@
"glyph": "+", "glyph": "+",
"category": "contextual", "category": "contextual",
"implementation": "actions/CopyAction.js", "implementation": "actions/CopyAction.js",
"depends": ["locationService", "copyService", "dialogService", "notificationService"] "depends": ["$log", "locationService", "copyService",
"dialogService", "notificationService"]
}, },
{ {
"key": "link", "key": "link",

View File

@ -34,9 +34,10 @@ define(
* @constructor * @constructor
* @memberof platform/entanglement * @memberof platform/entanglement
*/ */
function CopyAction(locationService, copyService, dialogService, notificationService, context) { function CopyAction($log, locationService, copyService, dialogService, notificationService, context) {
this.dialogService = dialogService; this.dialogService = dialogService;
this.notificationService = notificationService; this.notificationService = notificationService;
this.$log = $log;
AbstractComposeAction.call(this, locationService, copyService, context, "Duplicate", "to a location"); AbstractComposeAction.call(this, locationService, copyService, context, "Duplicate", "to a location");
} }
@ -75,9 +76,9 @@ define(
AbstractComposeAction.prototype.perform.call(this, progress) AbstractComposeAction.prototype.perform.call(this, progress)
.then(function(){ .then(function(){
self.notificationService.info("Copying complete."); self.notificationService.info("Copying complete.");
}, })
function (error){ .catch(function (error){
//log error self.$log.error("Error copying objects. ", error);
//Show more general error message //Show more general error message
self.notificationService.notify({ self.notificationService.notify({
title: "Error copying objects.", title: "Error copying objects.",

View File

@ -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 * @private
* @param progress * @param progress
* @returns {Function} a function that will perform the persistence * @returns {Function} a function that will perform the persistence