Child pages
  • ServoyException
Skip to end of metadata
Go to start of metadata


Return Types
DataException

Constants Summery
Number #ABSTRACT_FORM
Exception code for ABSTRACT_FORM.
Number #ACQUIRE_LOCK_FAILURE
Exception code for ACQUIRE_LOCK_FAILURE.
Number #BAD_SQL_SYNTAX
Exception code for BAD_SQL_SYNTAX.
Number #CLIENT_NOT_AUTHORIZED
Exception code for CLIENT_NOT_AUTHORIZED.
Number #DATA_ACCESS_RESOURCE_FAILURE
Exception code for DATA_ACCESS_RESOURCE_FAILURE.
Number #DATA_INTEGRITY_VIOLATION
Exception code for DATA_INTEGRITY_VIOLATION.
Number #DEADLOCK
Exception code for DEADLOCK.
Number #DELETE_NOT_GRANTED
Exception code for DELETE_NOT_GRANTED.
Number #EXECUTE_PROGRAM_FAILED
Exception code for EXECUTE_PROGRAM_FAILED.
Number #INCORRECT_LOGIN
Exception code for INCORRECT_LOGIN.
Number #INVALID_INPUT
Exception code for INVALID_INPUT.
Number #INVALID_INPUT_FORMAT
Exception code for INVALID_INPUT_FORMAT.
Number #INVALID_RESULTSET_ACCESS
Exception code for INVALID_RESULTSET_ACCESS.
Number #MAINTENANCE_MODE
Exception code for MAINTENANCE_MODE.
Number #NO_ACCESS
Exception code for NO_ACCESS.
Number #NO_CREATE_ACCESS
Exception code for NO_CREATE_ACCESS.
Number #NO_DELETE_ACCESS
Exception code for NO_DELETE_ACCESS.
Number #NO_LICENSE
Exception code for NO_LICENSE.
Number #NO_MODIFY_ACCESS
Exception code for NO_MODIFY_ACCESS.
Number #NO_PARENT_DELETE_WITH_RELATED_RECORDS
Exception code for NO_PARENT_DELETE_WITH_RELATED_RECORDS.
Number #NO_RELATED_CREATE_ACCESS
Exception code for NO_RELATED_CREATE_ACCESS.
Number #PERMISSION_DENIED
Exception code for PERMISSION_DENIED.
Number #RECORD_LOCKED
Exception code for RECORD_LOCKED.
Number #RECORD_VALIDATION_FAILED
Exception code for RECORD_VALIDATION_FAILED.
Number #SAVE_FAILED
Exception code for SAVE_FAILED.
Number #UNKNOWN_DATABASE_EXCEPTION
Exception code for UNKNOWN_DATABASE_EXCEPTION.

Method Summery
Number #getErrorCode()
Returns the error code for this ServoyException.
String #getMessage()
Returns the string message for this ServoyException.

Constants Details
ABSTRACT_FORM
Exception code for ABSTRACT_FORM.
Returns
Number
Sample
 
ACQUIRE_LOCK_FAILURE
Exception code for ACQUIRE_LOCK_FAILURE.
Returns
Number
Sample
 
BAD_SQL_SYNTAX
Exception code for BAD_SQL_SYNTAX.
Returns
Number
Sample
 
CLIENT_NOT_AUTHORIZED
Exception code for CLIENT_NOT_AUTHORIZED.
Returns
Number
Sample
 
DATA_ACCESS_RESOURCE_FAILURE
Exception code for DATA_ACCESS_RESOURCE_FAILURE.
Returns
Number
Sample
 
DATA_INTEGRITY_VIOLATION
Exception code for DATA_INTEGRITY_VIOLATION.
Returns
Number
Sample
 
DEADLOCK
Exception code for DEADLOCK.
Returns
Number
Sample
 
DELETE_NOT_GRANTED
Exception code for DELETE_NOT_GRANTED.
Returns
Number
Sample
 
EXECUTE_PROGRAM_FAILED
Exception code for EXECUTE_PROGRAM_FAILED.
Returns
Number
Sample
 
INCORRECT_LOGIN
Exception code for INCORRECT_LOGIN.
Returns
Number
Sample
 
INVALID_INPUT
Exception code for INVALID_INPUT.
Returns
Number
Sample
 
INVALID_INPUT_FORMAT
Exception code for INVALID_INPUT_FORMAT.
Returns
Number
Sample
 
INVALID_RESULTSET_ACCESS
Exception code for INVALID_RESULTSET_ACCESS.
Returns
Number
Sample
 
MAINTENANCE_MODE
Exception code for MAINTENANCE_MODE.
Returns
Number
Sample
 
NO_ACCESS
Exception code for NO_ACCESS.
Returns
Number
Sample
 
NO_CREATE_ACCESS
Exception code for NO_CREATE_ACCESS.
Returns
Number
Sample
 
NO_DELETE_ACCESS
Exception code for NO_DELETE_ACCESS.
Returns
Number
Sample
 
NO_LICENSE
Exception code for NO_LICENSE.
Returns
Number
Sample
 
NO_MODIFY_ACCESS
Exception code for NO_MODIFY_ACCESS.
Returns
Number
Sample
 
Exception code for NO_PARENT_DELETE_WITH_RELATED_RECORDS.
Returns
Number
Sample
 
Exception code for NO_RELATED_CREATE_ACCESS.
Returns
Number
Sample
 
PERMISSION_DENIED
Exception code for PERMISSION_DENIED.
Returns
Number
Sample
 
RECORD_LOCKED
Exception code for RECORD_LOCKED.
Returns
Number
Sample
 
RECORD_VALIDATION_FAILED
Exception code for RECORD_VALIDATION_FAILED.
Returns
Number
Sample
 
SAVE_FAILED
Exception code for SAVE_FAILED.
Returns
Number
Sample
 
UNKNOWN_DATABASE_EXCEPTION
Exception code for UNKNOWN_DATABASE_EXCEPTION.
Returns
Number
Sample
 

Method Details
getErrorCode

Number getErrorCode ()

Returns the error code for this ServoyException. Can be one of the constants declared in ServoyException.
Returns
Number – the error code for this ServoyException. Can be one of the constants declared in ServoyException.
Sample
//this sample script should be attached to onError method handler in the solution settings
var e = arguments[0];
application.output("Exception Object: "+e)
application.output("MSG: "+e.getMessage())
if (e instanceof ServoyException)
{
	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[i];
			application.output(record.exception);
			if (record.exception instanceof DataException)
			{
				application.output("SQL: "+record.exception.getSQL())
				application.output("SQLState: "+record.exception.getSQLState())
				application.output("VendorErrorCode: "+record.exception.getVendorErrorCode())
			}
		}
		return false
	}
}
//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 up
return true
getMessage

String getMessage ()

Returns the string message for this ServoyException.
Returns
String – the string message for this ServoyException.
Sample
//this sample script should be attached to onError method handler in the solution settings
var e = arguments[0];
application.output("Exception Object: "+e)
application.output("MSG: "+e.getMessage())
if (e instanceof ServoyException)
{
	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[i];
			application.output(record.exception);
			if (record.exception instanceof DataException)
			{
				application.output("SQL: "+record.exception.getSQL())
				application.output("SQLState: "+record.exception.getSQLState())
				application.output("VendorErrorCode: "+record.exception.getVendorErrorCode())
			}
		}
		return false
	}
}
//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 up
return true
  • No labels