Zotero.Exception.Alert when an alert title is specified

This commit is contained in:
Simon Kornblith 2012-07-10 02:46:24 -04:00
parent de6a776e88
commit bf4c5c1158

View file

@ -78,16 +78,16 @@ Zotero.Exception = {};
Zotero.Exception.Alert = function(name, params, title, cause) { Zotero.Exception.Alert = function(name, params, title, cause) {
this.name = name; this.name = name;
this.params = params || []; this.params = params || [];
this.title = title || "general.error"; this._title = title || "general.error";
this.cause = cause; this.cause = cause;
return this; return this;
}; };
Zotero.Exception.Alert.prototype = { Zotero.Exception.Alert.prototype = {
get title() { get title() {
if(this.title) { if(this._title) {
try { try {
return Zotero.getString(this.title); return Zotero.getString(this._title);
} catch(e) {} } catch(e) {}
} }
try { try {
@ -115,7 +115,11 @@ 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 {
Services.prompt.alert(window || null, this.title, this.toString()); Services.prompt.alert(window || null, this.title, this.toString());
}catch(e) {
Zotero.debug(e);
}
}, },
/** /**