From a17b1cd0e25f1c8e1d867fafdd091ca932e9964b Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 16 Jun 2025 16:32:15 +0530 Subject: [PATCH] fix: added mandatory field error toast --- frontend/src/data/document.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/data/document.js b/frontend/src/data/document.js index 76e35a9e..41bdea34 100644 --- a/frontend/src/data/document.js +++ b/frontend/src/data/document.js @@ -23,7 +23,14 @@ export function useDocument(doctype, docname) { toast.success(__('Document updated successfully')) }, onError: (err) => { - toast.error(__('Error updating document')) + let errorMessage = __('Error updating document') + if (err.exc_type == 'MandatoryError') { + const fieldName = err.messages + .map((msg) => msg.split(': ')[2].trim()) + .join(', ') + errorMessage = __('Mandatory field error: {0}', [fieldName]) + } + toast.error(errorMessage) console.error(err) }, },