diff --git a/ui/src/pages/definition/SaveTaskDialog.jsx b/ui/src/pages/definition/SaveTaskDialog.jsx index 7d6808ef94..7b1bc0ce65 100644 --- a/ui/src/pages/definition/SaveTaskDialog.jsx +++ b/ui/src/pages/definition/SaveTaskDialog.jsx @@ -49,11 +49,12 @@ export default function SaveTaskDialog({ onSuccess, onCancel, document }) { }, onError: (err) => { console.log("onerror", err); - let errStr = _.isString(err.body) - ? err.body - : JSON.stringify(err.body, null, 2); + const errObj = JSON.parse(err); + let errStr = errObj.validationErrors && errObj.validationErrors.length > 0 + ? `${errObj.validationErrors[0].message}: ${errObj.validationErrors[0].path}` + : errObj.message; setErrorMsg({ - message: `${TASK_SAVE_FAILED}: ${errStr}`, + message: `${TASK_SAVE_FAILED} ${errStr}`, dismissible: true, }); }, diff --git a/ui/src/pages/definition/SaveWorkflowDialog.jsx b/ui/src/pages/definition/SaveWorkflowDialog.jsx index 53a1cd1d6a..1d2a4d5069 100644 --- a/ui/src/pages/definition/SaveWorkflowDialog.jsx +++ b/ui/src/pages/definition/SaveWorkflowDialog.jsx @@ -81,10 +81,11 @@ export default function SaveWorkflowDialog({ onSuccess, onCancel, document }) { }, onError: (err) => { console.log("onerror", err); - let errStr = _.isString(err.body) - ? err.body - : JSON.stringify(err.body, null, 2); - setErrorMsg(`${WORKFLOW_SAVE_FAILED}: ${errStr}`); + const errObj = JSON.parse(err); + let errStr = errObj.validationErrors && errObj.validationErrors.length > 0 + ? `${errObj.validationErrors[0].message}: ${errObj.validationErrors[0].path}` + : errObj.message; + setErrorMsg(`${WORKFLOW_SAVE_FAILED} ${errStr}`); }, });