From 457b208cdffd91e851629357dd42ca8cad091711 Mon Sep 17 00:00:00 2001 From: ianb Date: Mon, 17 Nov 2008 17:28:31 +0000 Subject: Make the error messages somewhat more robust when e.args is empty --- docs/index.txt | 5 +++++ tempita/__init__.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/index.txt b/docs/index.txt index 7ef2598..ef2da2f 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -421,6 +421,11 @@ Still To Do News ==== +svn trunk +--------- + +* Make error message annotation slightly more robust + 0.2 --- diff --git a/tempita/__init__.py b/tempita/__init__.py index ee8a9a4..0ddb670 100644 --- a/tempita/__init__.py +++ b/tempita/__init__.py @@ -238,7 +238,10 @@ class Template(object): except: exc_info = sys.exc_info() e = exc_info[1] - e.args = (self._add_line_info(e.args[0], pos),) + if e.args: + e.args = (self._add_line_info(e.args[0], pos),) + else: + e.args = (self._add_line_info(None, pos),) raise exc_info[0], e, exc_info[2] def _repr(self, value, pos): -- cgit v1.2.1