assert
- assert(expression, message): void
-
Check if given value is
TRUE. If it is not, script execution stops with an assertion error;message, if given, is included in the error text.Table 1. Parameters expression
Boolean
Expression or value to evaluate
message
String
Optional. Message to report when the assertion fails.
When
messageis given,expressionmust be a boolean, number or string value; an object ornullcauses the runtime error "Argument is not of string type and cannot be converted to string" instead of an assertion failure (known issue, netxms#3787).node = FindObject("aaa"); assert(node != null); //Will go through, if object with name "aaa" found and will exit script if not assert(node != null, "Object aaa not found"); //Same, with custom message in the error text