Skip to content

Commit

Permalink
fix(style): use assert instead of console.error
Browse files Browse the repository at this point in the history
  • Loading branch information
czosel committed May 13, 2019
1 parent d17e055 commit f4473a0
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions addon/lib/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,11 @@ export default EmberObject.extend(Evented, {
*/
validate: task(function*() {
const specificValidation = this.get(`_validate${this.question.__typename}`);
if (!specificValidation) {
// eslint-disable-next-line no-console
console.error(
"Missing validation function for",
this.question.__typename
);
}
assert(
"Missing validation function for " + this.question.__typename,
specificValidation
);

const validationFns = [
...(!this.question.hidden ? [this._validateRequired] : []),
specificValidation
Expand Down Expand Up @@ -363,13 +361,13 @@ export default EmberObject.extend(Evented, {
if (!value) {
return true;
}
return value.map(value => {
return value.map(value =>
validate("inclusion", value, {
in: this.getWithDefault("question.multipleChoiceOptions.edges", []).map(
option => option.node.slug
)
});
});
})
);
},

/**
Expand Down

0 comments on commit f4473a0

Please sign in to comment.