Sometimes, you may want to generate your own messages and/or errors in response to specific conditions that can only be evaluated at run-time.
The macro functions that allow you to write instructions to generate your own messages or errors are:
Generates an error, with the message of your choice, if a given condition is not true. // check if the supplied month number is valid This is useful at places in macro code where you might think "if we are here then this condition must be true". Assertions ensure that this is verified or that an error is generated.
Depending on the value of the last parameter (true, in the above example), the generated error can cause only the current macro to abort and generate a run-time message similar to a token error (listed in the diary generation messages dialog), or it can cause the entire diary generation to abort. |
|
Generates a run-time message but does not affect the execution of the macro otherwise. // look for all holidays on same date These log messages are then included the diary generation messages dialog. |
|
Generates an error with the message text of your choice. switch nWeekdayNumber Depending on the value of the last parameter (true, in the above example), the generated error can cause only the current macro to abort and generate a run-time message similar to a token error (listed in the diary generation messages dialog), or it can cause the entire diary generation to abort. |
For more details on these 3 functions, click on their respective links, in the left column, above.
Topic 174300, last updated on 19-Apr-2020