Better tracebacks for LoraxTemplate
This commit is contained in:
parent
bf9ca1ddc7
commit
17e5f9e19a
@ -23,7 +23,7 @@ import sys
|
|||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from mako.lookup import TemplateLookup
|
from mako.lookup import TemplateLookup
|
||||||
from mako.exceptions import RichTraceback
|
from mako.exceptions import text_error_template
|
||||||
|
|
||||||
|
|
||||||
class LoraxTemplate(object):
|
class LoraxTemplate(object):
|
||||||
@ -39,11 +39,7 @@ class LoraxTemplate(object):
|
|||||||
try:
|
try:
|
||||||
textbuf = template.render(**variables)
|
textbuf = template.render(**variables)
|
||||||
except:
|
except:
|
||||||
traceback = RichTraceback()
|
print text_error_template().render()
|
||||||
for (filename, lineno, function, line) in traceback.traceback:
|
|
||||||
print "File %s, line %s, in %s" % (filename, lineno, function)
|
|
||||||
print line
|
|
||||||
|
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
# split, strip and remove empty lines
|
# split, strip and remove empty lines
|
||||||
|
Loading…
Reference in New Issue
Block a user