Handle style errors in CSL Preview window
Keep going, and log the error
This commit is contained in:
parent
9de954afc7
commit
55e8f7914b
1 changed files with 12 additions and 4 deletions
|
@ -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>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue