If I understand you, just have your subroutine change a global variable
to be the error message, then look at that on an undef return. You can make
it a list if you want to report more than one error.
You also might want to look into the <error:...> directive for the grammar.
I did look into <error:>. I even tried to mention it above,
though it apparently got eaten up as HTML so no one could see it.
I'm apparently having a problem placing that directive where it gets
activated only if the action fails.