Simplify invokeInternal exception handling.

Part of preparation for moving it into the generated code.
Generate handler currently in invokeInternal.
Eliminate use of a hack.