From 764b8d3618c2d293d1be79af652b796754d2b6ae Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 24 Dec 2009 23:20:14 +0000 Subject: [PATCH] More helpful error for moveTo() error with orphaned files during upgrade --- chrome/content/zotero/xpcom/schema.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index a997b88105..1eb567af89 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -1969,7 +1969,18 @@ Zotero.Schema = new function(){ target.remove(false); } } - orphan.file.moveTo(orphaned, newName); + try { + orphan.file.moveTo(orphaned, newName); + } + catch (e) { + if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED') { + throw ("Zotero cannot move orphaned file '" + orphan.file.path + "'"); + } + else { + Components.utils.reportError("Error moving orphaned file '" + orphan.file.leafName + "'"); + throw (e); + } + } movedFiles37[orphan.id] = orphan.file; } } @@ -2256,7 +2267,18 @@ Zotero.Schema = new function(){ target.remove(false); } } - orphan.file.moveTo(orphaned, newName); + try { + orphan.file.moveTo(orphaned, newName); + } + catch (e) { + if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED') { + throw ("Zotero cannot move orphaned file '" + orphan.file.path + "'"); + } + else { + Components.utils.reportError("Error moving orphaned file '" + orphan.file.leafName + "'"); + throw (e); + } + } movedFiles46[orphan.id] = orphan.file; } }