aboutsummaryrefslogtreecommitdiff
path: root/ext/js/templates/sandbox/template-renderer-frame-api.js
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 /ext/js/templates/sandbox/template-renderer-frame-api.js
parent73f06a3fa087af164c54b57b2d92466d689d107e (diff)
Update de/serializeError functions to only serialize data if present (#1849)
Diffstat (limited to 'ext/js/templates/sandbox/template-renderer-frame-api.js')
-rw-r--r--ext/js/templates/sandbox/template-renderer-frame-api.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/js/templates/sandbox/template-renderer-frame-api.js b/ext/js/templates/sandbox/template-renderer-frame-api.js
index f234c8e0..af83425b 100644
--- a/ext/js/templates/sandbox/template-renderer-frame-api.js
+++ b/ext/js/templates/sandbox/template-renderer-frame-api.js
@@ -72,12 +72,15 @@ class TemplateRendererFrameApi {
_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