Skip to main content

asserted

asserted( boolExpression : boolean ) : boolean
asserted( boolExpression : boolean, msg : string ) : boolean

ParameterTypeDescription
boolExpressionboolean->Boolean expression
msgstring->Text of error message
resultboolean<-Result of evaluation of boolExpression

Description

The asserted command returns the result of the evaluation of the boolExpression parameter. If boolExpression is false and if assertions are enabled, the error -10518 is generated, exactly as for the assert command. If the assertions are disabled, asserted returns the result of the expression that was passed without triggering an error.

asserted has an operation similar to that of the assert command, with one difference in that it returns a value which is the result of the evaluation of the boolExpression parameter. It therefore allows the use of an assertion during the evaluation of a condition (see the example). For more information about the operation of assertions and the parameters of this command, please refer to the description of the assert command.

Example

Insertion of an assertion in the evaluation of an expression:

 var employee : cs.EmployeeEntity
var status : Object
employee = ds.Employee.get(717)
status = employee.lock()
if(asserted(not(status.success)))
// triggers error -10518 if entity cannot be locked
end

See also

assert
.onErrCall()
setAssertEnabled