Fix exception response handling in generator code