codegen: put exception checks inside of a G_UNLIKELY

Fixes bug 730702