From fdbc4f8c7ec5fde594ee689fd26a1c0a5ef78825 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Tue, 9 Aug 2022 11:20:16 -0400 Subject: [PATCH] fix: add better error message for picklist --- src/utils/validation-utils.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/utils/validation-utils.js b/src/utils/validation-utils.js index 40bd0721..f3b52445 100644 --- a/src/utils/validation-utils.js +++ b/src/utils/validation-utils.js @@ -1,15 +1,15 @@ -import { getPicklistValues } from './data-loaders'; - -export const pickListValidation = (field, name) => (value, helper) => { - const pickList = getPicklistValues(); - - if (pickList[field].includes(value)) { - return value; - } - - return helper.message( - `${name || field} does not include a valid option ${pickList[field].join( - ', ', - )}`, - ); -}; +import { getPicklistValues } from './data-loaders'; + +export const pickListValidation = (field, name) => (value, helper) => { + const pickList = getPicklistValues(); + + if (pickList[field].includes(value)) { + return value; + } + + return helper.message( + `${name || field} does not include a valid option ${pickList[field].join( + ', ', + )} instead got '${value}'`, + ); +};