aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/anki-note-builder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-30 12:33:29 -0500
committerGitHub <noreply@github.com>2021-01-30 12:33:29 -0500
commitd0b8b605db93c51b5ce2501a482c57432b45bfa6 (patch)
treec42bf4f59d7945c8b9c42cd0677e3827d326a71a /ext/bg/js/anki-note-builder.js
parentaf6e9a8153c24d0400592005b31d56fecff67068 (diff)
Add note errors (#1329)
* Update _addAnkiNote to track errors * Change comparison * Update anki note adding to show errors * Fix template * Show errors when Anki card creation behaves unexpectedly * Update some errors related to anki media injection * Update addAnkiNote error handling * Improve Anki errors * Simplify error messages related to template rendering
Diffstat (limited to 'ext/bg/js/anki-note-builder.js')
-rw-r--r--ext/bg/js/anki-note-builder.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/bg/js/anki-note-builder.js b/ext/bg/js/anki-note-builder.js
index eae5fbe4..e1399f66 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -117,7 +117,11 @@ class AnkiNoteBuilder {
try {
return await this._renderTemplate(templates, data, marker);
} catch (e) {
- if (errors) { errors.push(e); }
+ if (errors) {
+ const error = new Error(`Template render error for {${marker}}`);
+ error.data = {error: e};
+ errors.push(error);
+ }
return `{${marker}-render-error}`;
}
});