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

Do not throw error on unexpected model attr in production #4040

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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