From 3f738898743804fa07c449063bf3065af00e5aa2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 25 Jul 2021 12:54:26 -0400 Subject: Update de/serializeError functions to only serialize data if present (#1849) --- test/test-anki-note-builder.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3