Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 3, 2021
1 parent 0b3df86 commit 7fa8222
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/combination/list/validate_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ const validateDuplicateId = function ({ dimension, id }, index, allIds) {
return
}

const userDimensions = [dimension, duplicateId.dimension].filter(
isUserDimension,
)
const { dimension: duplicateDimension } = duplicateId
const userDimensions = [dimension, duplicateDimension].filter(isUserDimension)
const errorSuffix =
userDimensions.length === 1
? `Please rename the ${userDimensions[0].messageName}.`
: `Please rename one of them.`
throw new UserError(`The identifier "${id}" must not be used both as ${dimension.messageName} and ${duplicateId.dimension.messageName}.
throw new UserError(`The identifier "${id}" must not be used both as ${dimension.messageName} and ${duplicateDimension.messageName}.
${errorSuffix}`)
}

Expand Down

0 comments on commit 7fa8222

Please sign in to comment.