Possible Feature: onPersistanceError

Hi,

We’ve got a large database backend which uses copious constraints to assure data integrity and we’re also exclusively using db_managed sequences.

I think it would be useful to have an event handler for forms along the lines of ‘onPersistanceError’ or ‘onDatabaseError’ where developer could trap any database errors and pass them to a global method for ‘processing’ before alerting the user.

In our setup, without this ability to trap db-errors, we’ve needed to write stored procedures to check whether a simple delete is possible and if it is, then issue a controller.deleteRecord statement. (If the delete would cause a constraint to fail, the procedure hands back an end-user friendly message which is displayed. Without this procedure checking, the end user could get a rather uninformative and vague error dialog from Servoy.)

In our environment, if we could trap db errors I expect all the procedures wouldn’t be needed.

Is something like this possible, or does the difference in how errors are raised/reported by the various RDBMS’s make this too challenging?

Thanks!

At first we thought we needed such a feature to. We use existing databases build with database maintained relationships. What we do now is check with (databaseManager.hasRecords()). Place buttons for delete if there are no ‘child’ records. It works but it is nothing more than a workaround. To speed up development we would really want the onPersistanceError feature. For less frequently used forms we would simple place all manipulation buttons, and let the database handle the rest.

Taking this somewhat further: it would be very nice if we could set the response in the relationmanagment screen, where the relation is defined. Something like an option RestrictErrorFunction=… So that Servoy would know which action to take when the Restrict error is raised, and call it automatically.

For us development speed is essential, not esthetics or maintainability. This functionality would help us a lot.