Handle style errors in CSL Preview window

Keep going, and log the error
This commit is contained in:
Dan Stillman 2021-12-15 17:21:26 -05:00
parent 9de954afc7
commit 55e8f7914b

View file

@ -60,11 +60,19 @@ var Zotero_CSL_Preview = new function() {
if (style.source) {
continue;
}
Zotero.debug("Generate Bib for " + style.title);
var cite = generateBibliography(style);
if (cite) {
Zotero.debug("Generate bibliography for " + style.title);
let bib;
let err = false;
try {
bib = generateBibliography(style);
}
catch (e) {
err = e;
Zotero.logError(e);
}
if (bib || err) {
str += '<h3>' + style.title + '</h3>';
str += cite;
str += bib || `<p style="color: red">${Zotero.Utilities.htmlSpecialChars(err)}</p>`;
str += '<hr>';
}
}