Skip to content

Commit

Permalink
map 404 error to 400 for classifier create when classification not found
Browse files Browse the repository at this point in the history
  • Loading branch information
rassokhin-s committed Dec 11, 2023
1 parent 246ec7e commit eea55f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/classifiers/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ module.exports = async (req, res) => {

// Get the classification ids for each output (or error if not found)
const outputMappings = params.classificationValues.map(parseClassifierOutputMapping)
const serverIds = await getIds(outputMappings.map(value => value.to))
let serverIds = {}
try {
serverIds = await getIds(outputMappings.map(value => value.to))
} catch (_) {
throw new ValidationError(_.message)
}
const outputs = outputMappings.map(value => ({ className: value.from, id: serverIds[value.to] }))

const createdById = req.rfcx.auth_token_info.id
Expand Down

0 comments on commit eea55f2

Please sign in to comment.