aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-25 12:54:26 -0400
committerGitHub <noreply@github.com>2021-07-25 12:54:26 -0400
commit3f738898743804fa07c449063bf3065af00e5aa2 (patch)
tree7942d5603796064160d4ab5992b73812914d45e4 /test
parent73f06a3fa087af164c54b57b2d92466d689d107e (diff)
Update de/serializeError functions to only serialize data if present (#1849)
Diffstat (limited to 'test')
-rw-r--r--test/test-anki-note-builder.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/test-anki-note-builder.js b/test/test-anki-note-builder.js
index 45087134..2e4beb21 100644
--- a/test/test-anki-note-builder.js
+++ b/test/test-anki-note-builder.js
@@ -92,12 +92,15 @@ async function createVM() {
_serializeError(error) {
try {
if (typeof error === 'object' && error !== null) {
- return {
+ const result = {
name: error.name,
message: error.message,
- stack: error.stack,
- data: error.data
+ stack: error.stack
};
+ if (Object.prototype.hasOwnProperty.call(error, 'data')) {
+ result.data = error.data;
+ }
+ return result;
}
} catch (e) {
// NOP