here is the code for handling servoy exception of your own.
the form is based on booktext table.
it has 5 fields.
“booktextid”, “comment text”, “itemtext”, “node id”, and
“node text”
var e = arguments[0];
application.output("Exception Object: "+e)
application.output("MSG: "+e.getMessage())
if (e.isServoyException)
{
application.output(“is a ServoyException”)
application.output("Errorcode: "+e.getErrorCode())
if (e.getErrorCode() == ServoyException.SAVE_FAILED)
{
plugins.dialogs.showErrorDialog( “Error”, “It seems you did not fill in a required field”, ‘OK’);
//Get the failed records after a save
var array = databaseManager.getFailedRecords()
for( var i = 0 ; i < array.length ; i++ )
{
var record = array*;*
-
plugins.dialogs.showInfoDialog( “Error Dialog”, "Record : " + record, “OK”)*
-
plugins.dialogs.showErrorDialog( “Error”, "Record Exception : " + record.exception, ‘OK’);*
-
application.output(record.exception);*
-
if (record.exception.isDataException)*
-
{*
-
plugins.dialogs.showErrorDialog( “Error”, "SQL: "+record.exception.getSQL(), ‘OK’);*
-
plugins.dialogs.showErrorDialog( “Error”, "SQLState: "+record.exception.getSQLState(), ‘OK’);*
-
plugins.dialogs.showErrorDialog( “Error”, "VendorErrorCode: "+record.exception.getVendorErrorCode(), ‘OK’); *
-
}*
-
}*
}
}
************************************************
but,
the thing is that when i am leaving the booktext id in the new record mode and filled up all other fields.
then,
var array = databaseManager.getFailedRecords()
when the above code get executed, the array.length will become 9.
why?
there is only one record which failed
beacause of booktextid = null.
then, the array.length must be equal to 1but it is 9.
why?