Skip to content

Commit

Permalink
slightly improved error reporting in survey plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bbonf committed Nov 30, 2023
1 parent e696102 commit b850818
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jspsych-plugins/plugin-survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ let IlsSurveyPlugin = (function (jspsych) {
// collect form data into this.data
// only entries defined in `fields` parameter will be collected
Object.keys(trial.fields).forEach(key => {
if (!(key in form)) {
throw new Error(`Missing value for field ${key}`);
}
this.data[key] = form[key].value;
});

Expand Down

0 comments on commit b850818

Please sign in to comment.