mongodb/mongo-ruby-driver — pull request #322 by gjmurakami-10gen (2013-12-03 21:22:22+00:00)
Title: significant refactoring - reduction of rescue and raise, return value simplification

This refactoring is necessary before the next round of TDD for bulk response collection and processing. There are many commits, but each is small so that the individual changes are easy to comprehend. The overall result is significant reduction in complexity, including reduction of rescue clauses, reduction of raise clauses and rescue/raise overhead and complexity, and elimination of superfluous code thanks to refactoring.

I hope that you find the overall processing flow easier to comprehend, including the main methods CollectionWriter#batch_write_incremental and BulkWriteCollectionView#execute. Suggestions for further improvement are welcome.