how about

OnError <do this here>

<do this here> could then be left up to the coder... it could be a function.... a snip of code.

or an evil goto