//this sample script should be attached to onError method handler in the solution settingsapplication.output('Exception Object: '+ex)application.output('MSG: '+ex.getMessage())if (ex instanceofServoyException){/** @type{ServoyException} */var servoyException = ex;application.output("is a ServoyException")application.output("Errorcode: "+servoyException.getErrorCode())var trace ="";if (ex.getScriptStackTrace) trace =servoyException.getScriptStackTrace();elseif (servoyException.getStackTrace) trace =servoyException.getStackTrace();if (servoyException.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 savevar array =databaseManager.getFailedRecords()for( var i =0 ; i <array.length ; i++ ) {var record = array[i];application.output(record.exception);if (record.exception instanceofDataException) {/** @type{DataException} */var dataException =record.exception;application.output('SQL: '+dataException.getSQL())application.output('SQLState: '+dataException.getSQLState())application.output('VendorErrorCode: '+dataException.getVendorErrorCode()) } }returnfalse }}//if returns false or no return, error is not reported to client; if returns true error is reported//by default error report means logging the error, in smart client an error dialog will also show upreturntrue
ACQUIRE_LOCK_FAILURE
Exception code for ACQUIRE_LOCK_FAILURE.
This code is used when a database failed to lock a row or table.
//this sample script should be attached to onError method handler in the solution settingsapplication.output('Exception Object: '+ex)application.output('MSG: '+ex.getMessage())if (ex instanceofServoyException){/** @type{ServoyException} */var servoyException = ex;application.output("is a ServoyException")application.output("Errorcode: "+servoyException.getErrorCode())var trace ="";if (ex.getScriptStackTrace) trace =servoyException.getScriptStackTrace();elseif (servoyException.getStackTrace) trace =servoyException.getStackTrace();if (servoyException.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 savevar array =databaseManager.getFailedRecords()for( var i =0 ; i <array.length ; i++ ) {var record = array[i];application.output(record.exception);if (record.exception instanceofDataException) {/** @type{DataException} */var dataException =record.exception;application.output('SQL: '+dataException.getSQL())application.output('SQLState: '+dataException.getSQLState())application.output('VendorErrorCode: '+dataException.getVendorErrorCode()) } }returnfalse }}//if returns false or no return, error is not reported to client; if returns true error is reported//by default error report means logging the error, in smart client an error dialog will also show upreturntrue
BAD_SQL_SYNTAX
Exception code for BAD_SQL_SYNTAX.
This code is used when a database exception is recognized as an sql syntax error.
//this sample script should be attached to onError method handler in the solution settingsapplication.output('Exception Object: '+ex)application.output('MSG: '+ex.getMessage())if (ex instanceofServoyException){/** @type{ServoyException} */var servoyException = ex;application.output("is a ServoyException")application.output("Errorcode: "+servoyException.getErrorCode())var trace ="";if (ex.getScriptStackTrace) trace =servoyException.getScriptStackTrace();elseif (servoyException.getStackTrace) trace =servoyException.getStackTrace();if (servoyException.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 savevar array =databaseManager.getFailedRecords()for( var i =0 ; i <array.length ; i++ ) {var record = array[i];application.output(record.exception);if (record.exception instanceofDataException) {/** @type{DataException} */var dataException =record.exception;application.output('SQL: '+dataException.getSQL())application.output('SQLState: '+dataException.getSQLState())application.output('VendorErrorCode: '+dataException.getVendorErrorCode()) } }returnfalse }}//if returns false or no return, error is not reported to client; if returns true error is reported//by default error report means logging the error, in smart client an error dialog will also show upreturntrue
CLIENT_NOT_AUTHORIZED
Exception code for CLIENT_NOT_AUTHORIZED.
This code is used when an client performs an action that requires the user to be logged in and the user has not logged in yet.
//this sample script should be attached to onError method handler in the solution settingsapplication.output('Exception Object: '+ex)application.output('MSG: '+ex.getMessage())if (ex instanceofServoyException){/** @type{ServoyException} */var servoyException = ex;application.output("is a ServoyException")application.output("Errorcode: "+servoyException.getErrorCode())var trace ="";if (ex.getScriptStackTrace) trace =servoyException.getScriptStackTrace();elseif (servoyException.getStackTrace) trace =servoyException.getStackTrace();if (servoyException.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 savevar array =databaseManager.getFailedRecords()for( var i =0 ; i <array.length ; i++ ) {var record = array[i];application.output(record.exception);if (record.exception instanceofDataException) {/** @type{DataException} */var dataException =record.exception;application.output('SQL: '+dataException.getSQL())application.output('SQLState: '+dataException.getSQLState())application.output('VendorErrorCode: '+dataException.getVendorErrorCode()) } }returnfalse }}//if returns false or no return, error is not reported to client; if returns true error is reported//by default error report means logging the error, in smart client an error dialog will also show upreturntrue
DATA_ACCESS_RESOURCE_FAILURE
Exception code for DATA_ACCESS_RESOURCE_FAILURE.
This code is used when a database exception received an error accessing storage devices.