Child pages
  • DataException

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummery
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summery
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getErrorCode()
Returns the error code for this ServoyException.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getMessage()
Returns the string message for this ServoyException.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object[]
Table Cell (td)
#getParameters()
Returns the parameters of the SQL query that caused this DataException in an array.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getSQL()
Returns the SQL query that caused this DataException.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getSQLState()
Returns the SQLState for this DataException.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#getValue()
Returns the value for this DataException.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getVendorErrorCode()
Returns the error code of the error thrown by the back-end database server.

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idgetErrorCode
classnode
Table Row (tr)
idname
Table Cell (td)
getErrorCode
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getErrorCode
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the error code for this ServoyException. Can be one of the constants declared in ServoyException.
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the error code for this ServoyException. Can be one of the constants declared in ServoyException.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//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
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetMessage
classnode
Table Row (tr)
idname
Table Cell (td)
getMessage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getMessage
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the string message for this ServoyException.
Table Row (tr)
idret
Table Cell (td)
Returns
String – the string message for this ServoyException.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//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
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetParameters
classnode
Table Row (tr)
idname
Table Cell (td)
getParameters
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object[]
Span
stylefloat: left; font-weight: bold;
idiets
getParameters
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the parameters of the SQL query that caused this DataException in an array.
Table Row (tr)
idret
Table Cell (td)
Returns
Object[] – the parameters of the SQL query that caused this DataException in an array.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var record = array[i];
application.output(record.exception);
if (record.exception instanceof DataException)
{   
	var param = record.exception.getParameters();
	for (j = 0; j < param.length; j++)
	{      
		application.output("SQL Parameter [" + j + "]: " + param[j]);  
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQL
classnode
Table Row (tr)
idname
Table Cell (td)
getSQL
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getSQL
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the SQL query that caused this DataException.
Table Row (tr)
idret
Table Cell (td)
Returns
String – the SQL query that caused this DataException.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var record = array[i];
application.output(record.exception);
if (record.exception instanceof DataException)
{
	application.output("SQL: " + record.exception.getSQL());
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQLState
classnode
Table Row (tr)
idname
Table Cell (td)
getSQLState
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getSQLState
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the SQLState for this DataException.
This is a "SQLstate" string, which follows either the XOPEN SQLstate conventions or the SQL 99 conventions.
The values of the SQLState string are described in the appropriate spec.
Table Row (tr)
idret
Table Cell (td)
Returns
String – the SQLState for this DataException.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var record = array[i];
application.output(record.exception);
if (record.exception instanceof DataException)
{
	application.output("SQLState: " + record.exception.getSQLState());
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetValue
classnode
Table Row (tr)
idname
Table Cell (td)
getValue
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
getValue
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the value for this DataException.
The value is the object thrown in table pre-insert, pre-update or pre-delete triggers.
Table Row (tr)
idret
Table Cell (td)
Returns
Object – the value for this DataException.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var record = array[i];
application.output(record.exception);
if (record.exception instanceof DataException)
{
	application.output("VALUE: " + record.exception.getValue());
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetVendorErrorCode
classnode
Table Row (tr)
idname
Table Cell (td)
getVendorErrorCode
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getVendorErrorCode
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the error code of the error thrown by the back-end database server.
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the error code of the error thrown by the back-end database server.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var record = array[i];
application.output(record.exception);
if (record.exception instanceof DataException)
{
	application.output("VendorErrorCode: " + record.exception.getVendorErrorCode());
}
Table Row (tr)
classlastDetailRow
Table Cell (td)