Errors Handling
CT ++ template engine can work in two modes: with the strict control of syntax (by default) and without. In case of the strict control of syntax exception std::logic_error is generated in the following cases:
- Maximum length of operator exceed.
- Found a syntax error in operator name. After construction <TMPL_ or </TMPL_ does not follow any of allowable names of tokens (var, include, loop, if, else, unless, udf).
The diagnostic message is: "Syntax error in <TMPL_operator_name PARAMETER_NAME at line LINE_NUMBER column COLUMN_NUMBER."
Example:
Syntax error in <TMPL_var too_long_dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa at line 132 column 116.
Exception std::logic_error generated always irrespective of a mode of check of syntax of a pattern in the following cases:
- Found crossing of operators.
Example:
<TMPL_loop loop_var>
<TMPL_if condition>
|---> crossing of TMPL_if and TMPL_loop
</TMPL_loop>
</TMPL_if>
The diagnostic message is: "Fatal: Logic error near at line LINE_NUMBER. Expected </TMPL_operator_name> but found </TMPL_operator_name>."
Example:
Fatal: Logic error near at line 123. Expected /TMPL_IF, but found /TMPL_LOOP.
- Found the syntactic error in a name of function, or required function does not exist.
Example:
Line 140 column 66: User defined function `FOOBAR' not found.
- Found incorrectly entered parameters.
In this case exceptions generated by a class param_data.
Names of functions and variables should not contain symbols '>', '(', ')', space and cannot begin with a symbol of underlining . By a call from operator TMPL_var it is possible to specify only one parameter of function.
Copyright © 2003 - 2005 CTPP Dev. Team | http://reki.ru/products/ctpp