Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Do not throw error on unexpected attr in prod. (#3959)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba committed Jan 30, 2018
1 parent ad18a99 commit 2575e38
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion shared/shot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2575e38

Please sign in to comment.