From b54b77a10798264a2e88c3e16aecc01f7da7f636 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 22 Mar 2013 17:47:35 -0400 Subject: [PATCH] Clarify WebDAV error messages --- chrome/content/zotero/xpcom/storage/webdav.js | 33 ++++++++++--------- chrome/locale/en-US/zotero/zotero.properties | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 8180e9c05..e8b6e6ea9 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -43,8 +43,6 @@ Zotero.Sync.Storage.WebDAV = (function () { * @param {Function} callback Callback f(item, mdate) */ function getStorageModificationTime(item, request) { - var funcName = "Zotero.Sync.Storage.WebDAV.getStorageModificationTime()"; - var uri = getItemPropertyURI(item); return Zotero.HTTP.promise("GET", uri, @@ -118,7 +116,8 @@ Zotero.Sync.Storage.WebDAV = (function () { }) .catch(function (e) { if (e instanceof Zotero.HTTP.UnexpectedStatusException) { - throw new Error("Unexpected status code " + e.status + " in " + funcName); + throw new Error("HTTP " + e.status + " error from WebDAV " + + "server for GET request"); } throw e; }); @@ -146,8 +145,9 @@ Zotero.Sync.Storage.WebDAV = (function () { .then(function (req) { return { mtime: mtime, hash: hash }; }) - .fail(function (e) { - throw new Error("Unexpected status code " + e.xmlhttp.status); + .catch(function (e) { + throw new Error("HTTP " + e.xmlhttp.status + + " from WebDAV server for HTTP PUT"); }); }; @@ -325,8 +325,9 @@ Zotero.Sync.Storage.WebDAV = (function () { default: Zotero.debug(response); - throw ("Unexpected file upload status " + status + - " in Zotero.Sync.Storage.WebDAV.onUploadComplete()"); + throw (Zotero.getString('sync.storage.error.fileUploadFailed') + + " " + Zotero.getString('sync.storage.error.checkFileSyncSettings') + + "\n\n" + "HTTP " + status); } return setStorageModificationTime(item) @@ -884,9 +885,8 @@ Zotero.Sync.Storage.WebDAV = (function () { return; } else if (status != 200) { - var msg = "Unexpected status code " + status - + " for request " + data.request.name - + " in Zotero.Sync.Storage.WebDAV.downloadFile()"; + var msg = "HTTP " + status + " from WebDAV server " + + " while downloading file"; Zotero.debug(msg, 1); Components.utils.reportError(msg); deferred.reject(Zotero.Sync.Storage.WebDAV.defaultError); @@ -992,8 +992,8 @@ Zotero.Sync.Storage.WebDAV = (function () { _cachedCredentials = false; } else { - throw("Unexpected status code " + e.status + " getting " - + "WebDAV last sync time"); + throw("HTTP " + e.status + " error from WebDAV server " + + "for GET request"); } return Q.reject(e); @@ -1039,8 +1039,9 @@ Zotero.Sync.Storage.WebDAV = (function () { } }); }) - .fail(function (e) { - var msg = "Unexpected error code " + req.status + " uploading storage success file"; + .catch(function (e) { + var msg = "HTTP " + req.status + " error from WebDAV server " + + "for PUT request"; Zotero.debug(msg, 2); Components.utils.reportError(msg); throw Zotero.Sync.Storage.WebDAV.defaultError; @@ -1063,8 +1064,8 @@ Zotero.Sync.Storage.WebDAV = (function () { }) .fail(function (e) { if (e instanceof Zotero.HTTP.UnexpectedStatusException) { - var msg = "Unexpected status code " + e.status + " " - + "for OPTIONS request caching WebDAV credentials"; + var msg = "HTTP " + e.status + " error from WebDAV server " + + "for OPTIONS request"; Zotero.debug(msg, 1); Components.utils.reportError(msg); throw new Error(Zotero.Sync.Storage.WebDAV.defaultErrorRestart); diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index e3d4b3065..8f38566e2 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -822,7 +822,7 @@ sync.storage.error.default = A file sync error occurred. Please try syncing sync.storage.error.defaultRestart = A file sync error occurred. Please restart %S and/or your computer and try syncing again.\n\nIf you receive this message repeatedly, submit an error report and post the Report ID to a new thread in the Zotero Forums. sync.storage.error.serverCouldNotBeReached = The server %S could not be reached. sync.storage.error.permissionDeniedAtAddress = You do not have permission to create a Zotero directory at the following address: -sync.storage.error.checkFileSyncSettings = Please check your file sync settings or contact your server administrator. +sync.storage.error.checkFileSyncSettings = Please check your file sync settings or contact your WebDAV server administrator. sync.storage.error.verificationFailed = %S verification failed. Verify your file sync settings in the Sync pane of the Zotero preferences. sync.storage.error.fileNotCreated = The file '%S' could not be created in the Zotero 'storage' directory. sync.storage.error.encryptedFilenames = Error creating file '%S'.\n\nSee http://www.zotero.org/support/kb/encrypted_filenames for more information.