www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 629f4b3cc5b7d278b9439391be1264d3192fcda2
parent 88be8866120cdc845e44479fe4e512f67c9bcad8
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 19 Feb 2015 17:06:35 -0500

Make Zotero.Error instanceof Error, and give a less ugly name

Diffstat:
Mchrome/content/zotero/xpcom/error.js | 4+++-
Mchrome/content/zotero/xpcom/sync.js | 2+-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/error.js b/chrome/content/zotero/xpcom/error.js @@ -25,7 +25,7 @@ Zotero.Error = function (message, error, data) { - this.name = "ZOTERO_ERROR"; + this.name = "Zotero Error"; this.message = message; this.data = data; if (parseInt(error) == error) { @@ -35,6 +35,8 @@ Zotero.Error = function (message, error, data) { this.error = Zotero.Error["ERROR_" + error] ? Zotero.Error["ERROR_" + error] : 0; } } +Zotero.Error.prototype = new Error; + Zotero.Error.ERROR_UNKNOWN = 0; Zotero.Error.ERROR_MISSING_OBJECT = 1; diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -2416,7 +2416,7 @@ Zotero.Sync.Server = new function () { function _error(e, extraInfo, skipReload) { - if (e.name && e.name == 'ZOTERO_ERROR') { + if (e instanceof Zotero.Error) { switch (e.error) { case Zotero.Error.ERROR_MISSING_OBJECT: case Zotero.Error.ERROR_FULL_SYNC_REQUIRED: