Unable to prevent workflow action on certain condition

Hi Team,

for the below client side script, unable to prevent workflow application and hence, workflow_state is changing,

Tried frappe.throw, but it is unhandled and blocks the screen.

Script

frappe.ui.form.on('vmsTrip', {
    before_workflow_action: function(frm, cdt, cdn) {
        // Check if the selected workflow action is 'Sendback'
        if (frm.selected_workflow_action === 'Sendback') {
            // Ensure send_back_comments is not empty
            if (!frm.doc.send_back_comments || frm.doc.send_back_comments.trim() === '') {
                //frappe.throw(__('Please add comments before sending back the document.'));
                frappe.msgprint(__('Please add comments before sending back the document.'));
                // Prevent workflow action from executing
                return false; // Explicitly return false to stop default behavior
            }
        }
    },