Passing the SQL Backend error to the client screen

Hi all,

I have the following method setup on Servoy Forms Property On Record Save to pass the SQL Backend error to the client screen, but unfortunately in event of error no message gets passed on the client screen.
Is there any thing is missing from this method or do you have any other solution to pass the SQL Backend to the client screen?

application.setErrorCapture(true);

var error = application.getLastErrorCode();

//if the variable “error” <> 0 then there was an error
if(error > 0)
{
var errText = databaseManager.getLastDatabaseMessage();
//show it in a dialog
plugins.dialogs.showErrorDialog( “Error”, “There was an error:\n” + errText, “OK”)
return;
}

Please let me know.

Thanks in advance.

Abrahim

in which case do you get a SQL Backend Error?
If you use databaseManager.getDataSetByQuery(…) the error can be retrieved from the returned resultset.

application.getLastErrorCode() is on the planning for 2.5 to work for more database error such as unique contraint violations.