commit 1f93fa405cde42e42ddd7d012aa33699186b6327
parent 6a42d2ee1216c3bd14bb08a1cdb453e556615e80
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 7 Sep 2010 08:57:35 +0000
Fix an NS_ERROR_FAILURE from nsIFileURL.file, though I don't yet know what causes it
Diffstat:
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translate.js b/chrome/content/zotero/xpcom/translate.js
@@ -1530,16 +1530,24 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) {
var uri = IOService.newURI(item.path, "", null);
}
catch (e) {
- Components.utils.reportError("Error parsing attachment path: " + item.path);
- Zotero.debug("Translate: Error parsing attachment path '" + item.path + "'", 2);
+ var msg = "Error parsing attachment path: " + item.path;
+ Components.utils.reportError(msg);
+ Zotero.debug("Translate: " + msg, 2);
}
if (uri) {
- var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
-
- if (file.path == '/') {
- Components.utils.reportError("Error parsing attachment path: " + item.path);
- Zotero.debug("Translate: Error parsing attachment attachment '" + item.path + "'", 2);
+ try {
+ var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
+ if (file.path == '/') {
+ var msg = "Error parsing attachment path: " + item.path;
+ Components.utils.reportError(msg);
+ Zotero.debug("Translate: " + msg, 2);
+ }
+ }
+ catch (e) {
+ var msg = "Error getting file from attachment path: " + item.path;
+ Components.utils.reportError(msg);
+ Zotero.debug("Translate: " + msg, 2);
}
}