Skip to content

Commit

Permalink
Update importSurveyQuestions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
alexd-bes committed Aug 28, 2024
1 parent b3f5feb commit 24fd8b5
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,9 @@ export async function importSurveysQuestions({ models, file, survey, dataGroup,
}

if (errors.length > 0) {
const flatErrors = errors.reduce((acc, error) => {
if (error.extraFields.errors) {
return [...acc, ...error.extraFields.errors];
}
return [...acc, error];
}, []);

throw new MultiValidationError(
'Errors occurred while importing questions',
flatErrors.map(({ message, extraFields }) => ({
errors.map(({ message, extraFields }) => ({
message,
extraFields,
})),
Expand Down

0 comments on commit 24fd8b5

Please sign in to comment.