Alter semantics of Zotero.Exception.Alert() so that toString() returns the cause if there is one
This commit is contained in:
parent
de2d1669fe
commit
910f698ea2
|
@ -98,10 +98,7 @@ Zotero.Exception.Alert.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
get message() {
|
||||||
* Gets the error string
|
|
||||||
*/
|
|
||||||
"toString":function() {
|
|
||||||
try {
|
try {
|
||||||
return Zotero.getString(this.name, this.params);
|
return Zotero.getString(this.name, this.params);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
@ -109,6 +106,13 @@ Zotero.Exception.Alert.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the error string
|
||||||
|
*/
|
||||||
|
"toString":function() {
|
||||||
|
return this.cause.toString() || this.message;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presents the error in a dialog
|
* Presents the error in a dialog
|
||||||
* @param {DOMWindow} window The window to which the error should be attached
|
* @param {DOMWindow} window The window to which the error should be attached
|
||||||
|
@ -116,8 +120,8 @@ Zotero.Exception.Alert.prototype = {
|
||||||
"present":function(window) {
|
"present":function(window) {
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
try {
|
try {
|
||||||
Services.prompt.alert(window || null, this.title, this.toString());
|
Services.prompt.alert(window || null, this.title, this.message);
|
||||||
}catch(e) {
|
} catch(e) {
|
||||||
Zotero.debug(e);
|
Zotero.debug(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user