JavaScript return code properties

Use these properties (which are represented internally as integer values) to test the values returned by object methods such as SCFile. To print the error message rather than the return code, use the RCtoString function.

Return code Description

RC_ERROR

Some other error occurred. Examine the contents of the Messages view or the sm.log file for more information.

RC_SUCCESS

The operation succeeded.

RC_CANT_HAVE

The operation failed because the resource is unavailable because some other user or process has the resource locked.

RC_NO_MORE

No more records are available in the result set.

RC_DUPLICATE_KEY

The insert operation failed because the file already contains a record with this unique key value.

RC_MODIFIED

The update operation failed because the record was modified by another user or process since you read it.

RC_DELETED

The operation failed because the record was deleted by another user or process.

RC_BAD_QUERY

The query failed due to incorrect query syntax.

RC_NOT_AUTHORIZED

The request operation was not performed due to an authorization failure. Check the permissions associated with the user who submitted the request.

RC_VALIDATION_FAILED

The operation failed because the data supplied in a field or the record did not pass validity checks performed by the application.

RC_UNABLE_TO_WRITE_TO_FILE

The operation failed. Check to make sure the file name is correct, that the file exists, and that it is not read-only.

RC_UNABLE_TO_CLOSE_FILE

The operation failed. Check to make sure the file name is correct, that the file exists, and that it is not read-only.

RC_UNABLE_TO_DELETE_FILE

The operation failed. Check to make sure the file name is correct, that the file exists, and that it is not read-only.

RC_INVALID_FILENAME

The operation failed because the file name is not valid.

Example:

var rc = mySCFile.doInsert();
if ( rc == RC_SUCCESS )
{
	print( "Insert succeeded" );
}
else
	throw( "Error " + RCtoString(rc) + " occurred trying to insert a 
	record" );