From 2575e38aba88d6576d3467399e6b88f139383513 Mon Sep 17 00:00:00 2001 From: Barry Chen Date: Tue, 30 Jan 2018 11:08:55 -0600 Subject: [PATCH] Do not throw error on unexpected attr in prod. (#3959) --- shared/shot.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/shot.js b/shared/shot.js index 0b65cda3d9..1a733410f6 100644 --- a/shared/shot.js +++ b/shared/shot.js @@ -247,9 +247,15 @@ class AbstractShot { } } + let isProd = typeof process !== "undefined" && process.env.NODE_ENV === "production"; + for (let attr in attrs) { if (attr !== "clips" && attr !== "id" && this.REGULAR_ATTRS.indexOf(attr) === -1 && this.DEPRECATED_ATTRS.indexOf(attr) === -1) { - throw new Error("Unexpected attribute: " + attr); + if (isProd) { + console.warn("Unexpected attribute: " + attr); + } else { + throw new Error("Unexpected attribute: " + attr); + } } else if (attr === "id") { console.warn("passing id in attrs in AbstractShot constructor"); console.trace();