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

This commit is contained in:
Dan Stillman 2015-02-19 17:06:35 -05:00
parent 88be886612
commit 629f4b3cc5
2 changed files with 4 additions and 2 deletions

View file

@ -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;

View file

@ -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: