Fix missing error logging when logging debug info (#1758)

This commit is contained in:
toasted-nutbread 2021-06-26 15:27:33 -04:00 committed by GitHub
parent 8d1d428ed4
commit f389b3c232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1961,10 +1961,10 @@ class Display extends EventDispatcher {
for (const mode of modes) { for (const mode of modes) {
let ankiNote; let ankiNote;
let ankiNoteException; let ankiNoteException;
const ankiNoteErrors = []; const errors = [];
try { try {
const noteContext = this._getNoteContext(); const noteContext = this._getNoteContext();
ankiNote = await this._createNote(dictionaryEntry, mode, noteContext, false, ankiNoteErrors); ankiNote = await this._createNote(dictionaryEntry, mode, noteContext, false, errors);
} catch (e) { } catch (e) {
ankiNoteException = e; ankiNoteException = e;
} }
@ -1972,6 +1972,9 @@ class Display extends EventDispatcher {
if (typeof ankiNoteException !== 'undefined') { if (typeof ankiNoteException !== 'undefined') {
entry.ankiNoteException = ankiNoteException; entry.ankiNoteException = ankiNoteException;
} }
if (errors.length > 0) {
entry.errors = errors;
}
ankiNotes.push(entry); ankiNotes.push(entry);
} }
result.ankiNotes = ankiNotes; result.ankiNotes = ankiNotes;