1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #19923 -- Display tracebacks for non-CommandError exceptions

By default, show tracebacks for management command errors when the
exception is not a CommandError.
Thanks Jacob Radford for the report.
This commit is contained in:
Claude Paroz
2013-03-09 12:38:45 +01:00
parent 5e80571bf9
commit 6a91b63842
3 changed files with 24 additions and 7 deletions

View File

@@ -241,7 +241,7 @@ class BaseCommand(object):
except Exception as e:
# self.stderr is not guaranteed to be set here
stderr = getattr(self, 'stderr', OutputWrapper(sys.stderr, self.style.ERROR))
if options.traceback:
if options.traceback or not isinstance(e, CommandError):
stderr.write(traceback.format_exc())
else:
stderr.write('%s: %s' % (e.__class__.__name__, e))