On Dec 8, 2005, at 7:07 PM, Lachlan Cannon wrote:
Is there a reason we use a <object>DoesNotExist rather than just
using a
single ObjectDoesNotExist exception for everything?
Yes.
Consider::
try:
do_something_that_involves_multiple_models()
except ModelOneDoesNotExist:
handle_missing_one()
except ModelTwoDoesNotExist:
handle_missing_two()
That is, there are times it's good to know what object is missing as
part of a complex operation. All DoesNotExist exceptions inherit
from django.core.exceptions.ObjectDoesNotExist, so you don't have to
worry about this unless you need it, though.
Jacob