tleach/mongothon — pull request #13 by tleach (2013-11-05 22:58:04+00:00)
Title: Model.find_by_id() now raises a NotFoundException is the record does not exist

This is a concession to the reality that 99% of the time, if you are calling this method you are pretty certain the record exists and if it does not exist you almost always want to bail out.

Throwing an exception here helps as it saves the caller the boilerplate of needing to check the response. Instead, you can put a global exception handler at the top of your stack and handle the failure appropriately.