Frappe.throw() from on_update(self) event isn't preventing workflow from being updated to next state

In a doctype when the workflow changes, it’s triggering the server side on_update(self) event. From there I’m throwing an error using frappe.throw() based on a condition. If the condition is true I’m getting the error in the client side, but also the workflow is changing to the next state.

The workflow is not supposed to be changed to next state when there is a frappe.throw() from on_update(self) event, rather it should remain in the previous state.

Any clue where is the problem?

Regards
Sanaulla Haq

Try a frappe.db.rollback() to reset any changes before the throw.

Thanks for the reply. For now pursued with validate() event.