Page 1 of 1

Best way to send a message from PO.beforeDelete failure

PostPosted: Sun Jun 26, 2005 3:17 pm
by neilg
You've got a class thar extends PO . You want to check some logic that prevents the deletion of a record. You override the method PO.before(delete):boolean in your PO class.

Now you need to send some diagnostic info back to the client. You can't just have a message 'failed to delete'.

Code: Select all
...check my precondition..
if fails
        {
            throw new MyRuntimeException("Sorry you cant delete this record. This is the reason why.");
        }
       
        return true;


Disclaimer: not sure if this is the best practice. Will keep this thread updated as I learn.

Tested on 2.5.1g