Make Zotero.Error instanceof Error, and give a less ugly name
This commit is contained in:
parent
88be886612
commit
629f4b3cc5
2 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue