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

Commit

Permalink
Merge pull request #4040 from chenba/3959-no-unexpected-attr-errors
Browse files Browse the repository at this point in the history
Do not throw error on unexpected model attr in production
  • Loading branch information
ianb authored Feb 1, 2018
2 parents 8f8c773 + 2575e38 commit 4de2ffc
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 4de2ffc

Please sign in to comment.