With NAV2009 SP1, a new function is shipped. ASSERTERROR.
It is implemented to support testing codeunits like described in Kine's blog.
However, it might also be usefull for errortesting in NAS / Job Scheduler processes. You can run a codeunit and write code to handle different error messages.
More information about the function and syntax:
PS: Does anyone know there it is in the F5 symbol menu?