ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Python msgprint raises Exception in the console

Hello
i want to prevent the user from saving a Web-form if he has Entered an invalid Entry
When i use the command
frappe.msgprint(" some message",raise_exception = True)

The document is not saved: Good
An Error message is popped up: Good
The web console shows Error: Bad

An Example:

The same javascript command ( frappe.msgprint) do the same thing except it doesn’t raise an Error in the console which is something Good…

Did i miss something?
Is this Normal ?
This is a snapshot of my code

class DOCTYPENAME(Document):
    def validate(self):
        self.checksomething()
   def checksomething(self):
       if certain_condtition:
           frappe.msgprint("Some message", raise_Exception=True)

try:
frappe.throw(" some message")

3 Likes

Same issue… Error is raised when i click the save button…
i have even tested
frappe.msgprint('somemessage' )
i.e without the raise_exception=True argument, but it didn’t work…

This one, Worked For Me. Thanks a lot.