Debug::assert
This method allows to check if some Boolean condition evaluates to true and if it doesn't - stop further execution and show stack trace. Debug::assert() should be used to validate some assumptions made in the code which should never happen if nothing is broken in the application. It means that wrong user input should not be asserted but rather validated by normal if statement and exception should be thrown if the input is wrong. However, if the code relies, for example, on query data source name, which can be broken only in development time - that is a good place to add assert to.
Example:
Query query = new Query(querystr(Alertsetup));
QueryBuildDataSource qbds;
;
qbds = query.dataSourceName(identifierstr(EventRule));
Debug::assert(qbds != null);
Example:
Query query = new Query(querystr(Alertsetup));
QueryBuildDataSource qbds;
;
qbds = query.dataSourceName(identifierstr(EventRule));
Debug::assert(qbds != null);
No comments:
Post a Comment