[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py Made error handler more robust.

Malthe Borch mborch at gmail.com
Sat Nov 15 19:27:21 EST 2008


Log message for revision 92995:
  Made error handler more robust.

Changed:
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py

-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-15 23:16:55 UTC (rev 92994)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-16 00:27:21 UTC (rev 92995)
@@ -279,8 +279,11 @@
 
     # extract line number from traceback object
     cls, exc, tb = exc_info
-    lineno = tb.tb_next.tb_next.tb_lineno-1
-
+    try:
+        lineno = tb.tb_next.tb_next.tb_lineno-1
+    except AttributeError:
+        lineno = 1
+        
     # locate source code annotation (these are available from
     # the template source as comments)
     source = source.split('\n')
@@ -306,6 +309,9 @@
         
     if issubclass(cls, Exception):
         class RuntimeError(cls):
+            def __init__(self, *args, **kwargs):
+                pass
+            
             def __str__(self):
                 return "%s\n%s: %s" % (
                     error_msg, __name__, error_string)



More information about the Checkins mailing list