Clarify WebDAV error messages

This commit is contained in:
Dan Stillman 2013-03-22 17:47:35 -04:00
parent ffcabcd44e
commit b54b77a107
2 changed files with 18 additions and 17 deletions

View File

@ -43,8 +43,6 @@ Zotero.Sync.Storage.WebDAV = (function () {
* @param {Function} callback Callback f(item, mdate) * @param {Function} callback Callback f(item, mdate)
*/ */
function getStorageModificationTime(item, request) { function getStorageModificationTime(item, request) {
var funcName = "Zotero.Sync.Storage.WebDAV.getStorageModificationTime()";
var uri = getItemPropertyURI(item); var uri = getItemPropertyURI(item);
return Zotero.HTTP.promise("GET", uri, return Zotero.HTTP.promise("GET", uri,
@ -118,7 +116,8 @@ Zotero.Sync.Storage.WebDAV = (function () {
}) })
.catch(function (e) { .catch(function (e) {
if (e instanceof Zotero.HTTP.UnexpectedStatusException) { 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; throw e;
}); });
@ -146,8 +145,9 @@ Zotero.Sync.Storage.WebDAV = (function () {
.then(function (req) { .then(function (req) {
return { mtime: mtime, hash: hash }; return { mtime: mtime, hash: hash };
}) })
.fail(function (e) { .catch(function (e) {
throw new Error("Unexpected status code " + e.xmlhttp.status); throw new Error("HTTP " + e.xmlhttp.status
+ " from WebDAV server for HTTP PUT");
}); });
}; };
@ -325,8 +325,9 @@ Zotero.Sync.Storage.WebDAV = (function () {
default: default:
Zotero.debug(response); Zotero.debug(response);
throw ("Unexpected file upload status " + status + throw (Zotero.getString('sync.storage.error.fileUploadFailed') +
" in Zotero.Sync.Storage.WebDAV.onUploadComplete()"); " " + Zotero.getString('sync.storage.error.checkFileSyncSettings')
+ "\n\n" + "HTTP " + status);
} }
return setStorageModificationTime(item) return setStorageModificationTime(item)
@ -884,9 +885,8 @@ Zotero.Sync.Storage.WebDAV = (function () {
return; return;
} }
else if (status != 200) { else if (status != 200) {
var msg = "Unexpected status code " + status var msg = "HTTP " + status + " from WebDAV server "
+ " for request " + data.request.name + " while downloading file";
+ " in Zotero.Sync.Storage.WebDAV.downloadFile()";
Zotero.debug(msg, 1); Zotero.debug(msg, 1);
Components.utils.reportError(msg); Components.utils.reportError(msg);
deferred.reject(Zotero.Sync.Storage.WebDAV.defaultError); deferred.reject(Zotero.Sync.Storage.WebDAV.defaultError);
@ -992,8 +992,8 @@ Zotero.Sync.Storage.WebDAV = (function () {
_cachedCredentials = false; _cachedCredentials = false;
} }
else { else {
throw("Unexpected status code " + e.status + " getting " throw("HTTP " + e.status + " error from WebDAV server "
+ "WebDAV last sync time"); + "for GET request");
} }
return Q.reject(e); return Q.reject(e);
@ -1039,8 +1039,9 @@ Zotero.Sync.Storage.WebDAV = (function () {
} }
}); });
}) })
.fail(function (e) { .catch(function (e) {
var msg = "Unexpected error code " + req.status + " uploading storage success file"; var msg = "HTTP " + req.status + " error from WebDAV server "
+ "for PUT request";
Zotero.debug(msg, 2); Zotero.debug(msg, 2);
Components.utils.reportError(msg); Components.utils.reportError(msg);
throw Zotero.Sync.Storage.WebDAV.defaultError; throw Zotero.Sync.Storage.WebDAV.defaultError;
@ -1063,8 +1064,8 @@ Zotero.Sync.Storage.WebDAV = (function () {
}) })
.fail(function (e) { .fail(function (e) {
if (e instanceof Zotero.HTTP.UnexpectedStatusException) { if (e instanceof Zotero.HTTP.UnexpectedStatusException) {
var msg = "Unexpected status code " + e.status + " " var msg = "HTTP " + e.status + " error from WebDAV server "
+ "for OPTIONS request caching WebDAV credentials"; + "for OPTIONS request";
Zotero.debug(msg, 1); Zotero.debug(msg, 1);
Components.utils.reportError(msg); Components.utils.reportError(msg);
throw new Error(Zotero.Sync.Storage.WebDAV.defaultErrorRestart); throw new Error(Zotero.Sync.Storage.WebDAV.defaultErrorRestart);

View File

@ -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.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.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.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.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.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. sync.storage.error.encryptedFilenames = Error creating file '%S'.\n\nSee http://www.zotero.org/support/kb/encrypted_filenames for more information.