Preventing the document from saving without throwing an error


I was wondering if it’s possible to stop a document from saving without using
“frappe.throw()” with the python controllers. The behaviour i’m looking or is exactly like the custom script’s “frappe.validated = false”. However, this doesn’t work in frappe’s python controllers and I have to resort to throwing an error to stop execution.

Is throwing an error (that has to be uncatchable to stop the document from saving) really the only way to stop saving? Throwing an error that prints its entire stack trace in the client’s console surely isn’t good practice?

Would really appreciate some clarification/help.

Thanks! :slight_smile: