re-raise error if error occurs before committing in streaming

update the tests, using an if-else