Remove sys.exit from django-evolution evolve
Review Request #1633 — Created June 3, 2010 and submitted
When django-evolution evolve hits a problem, it currently dumps out the error string, and then uses sys.exit to escape. This is problematic when attempting to leverage django-evolution programmatically, since we really don't want to have to catch the SystemExit exception. The preferred way of signaling when something has gone wrong with a Django command is with the CommandError exception. I've replaced all instances of sys.exit with this exception. I've also taken the code out of handler, and put it in a new method called evolve. This will make it much easier to call evolve programmatically, and to catch exceptions.
All tests pass.
-
Personally I think that catching a SystemError is better. Just because other things like django.core and distutils are code we cannot change, and they might exit. That's just my two cents.