diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2011-12-22 22:08:32 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2011-12-22 22:08:32 +0000 |
| commit | 98c974c70b4065e649a1d1f0b21062d48bec4bdb (patch) | |
| tree | 8d2bcedd2e63c284a9171773ce9b8c90b09d10ac | |
| parent | 287565779d3ae4d3229ecbb2ff356c79b920e7d0 (diff) | |
Fixed super-edge-case bug in debug view where exc_value.args was empty. I managed to trigger this in some template code
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17245 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/views/debug.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index caa3fa6971..e150ca07a4 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -302,8 +302,14 @@ class ExceptionReporter(object): top = max(1, line - context_lines) bottom = min(total, line + 1 + context_lines) + # In some rare cases, exc_value.args might be empty. + try: + message = self.exc_value.args[0] + except IndexError: + message = '(Could not get exception message)' + self.template_info = { - 'message': self.exc_value.args[0], + 'message': message, 'source_lines': source_lines[top:bottom], 'before': before, 'during': during, |
