objgenerator: Implement exception handling for generators

This is required to properly handle exceptions across yields.

This fixes initial issue identified in #243.