Bug 617523: Add better logging for failed file moves during extension installation. r=robstring, a=dtownsend
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 08 Dec 2010 10:50:28 -0800
changeset 58901 93ad1a7be79192e2a45624a08173e934a0536fbd
parent 58900 3171bf1a510970a5c61af4238cbc6a44fa9c9079
child 58902 56a617969b41e15e1e811a508239ec0a2944565e
push idunknown
push userunknown
push dateunknown
reviewersrobstring, dtownsend
bugs617523
milestone2.0b8pre
Bug 617523: Add better logging for failed file moves during extension installation. r=robstring, a=dtownsend
toolkit/mozapps/extensions/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -228,20 +228,26 @@ SafeMoveOperation.prototype = {
     }
 
     // Note we put the directory move in after all the file moves so the
     // directory is recreated before all the files are moved back
     this._movedFiles.push({ oldFile: aDirectory, newFile: newDir });
   },
 
   _moveDirEntry: function(aDirEntry, aTargetDirectory) {
-    if (aDirEntry.isDirectory())
-      this._moveDirectory(aDirEntry, aTargetDirectory);
-    else
-      this._moveFile(aDirEntry, aTargetDirectory);
+    try {
+      if (aDirEntry.isDirectory())
+        this._moveDirectory(aDirEntry, aTargetDirectory);
+      else
+        this._moveFile(aDirEntry, aTargetDirectory);
+    }
+    catch (e) {
+      ERROR("Failure moving " + aDirEntry.path + " to " + aTargetDirectory.path);
+      throw e;
+    }
   },
 
   /**
    * Moves a file or directory into a new directory. If an error occurs then all
    * files that have been moved will be moved back to their original location.
    *
    * @param  aFile
    *         The file or directory to be moved.
@@ -249,17 +255,16 @@ SafeMoveOperation.prototype = {
    *         The directory to move into, this is expected to be an empty
    *         directory.
    */
   move: function(aFile, aTargetDirectory) {
     try {
       this._moveDirEntry(aFile, aTargetDirectory);
     }
     catch (e) {
-      ERROR("Failure moving " + aFile.path + " to " + aTargetDirectory.path);
       this.rollback();
       throw e;
     }
   },
 
   /**
    * Rolls back all the moves that this operation performed. If an exception
    * occurs here then both old and new directories are left in an indeterminate