Skip to content

Commit 19751cd

Browse files
committed
Print backtrace for errors in mako templates
Print the exact location of errors in mako templates by printing a full backtrace instead of a stripped output without the file:line information
1 parent 73d85ef commit 19751cd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

scripts/util.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (C) 2022 Intel Corporation
2+
Copyright (C) 2022-2024 Intel Corporation
33
44
Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
55
See LICENSE.TXT
@@ -14,7 +14,7 @@
1414
import json
1515
import yaml
1616
from mako.template import Template
17-
from mako.exceptions import RichTraceback
17+
from mako import exceptions
1818
try:
1919
from yaml import CLoader as Loader, CDumper as Dumper
2020
except ImportError:
@@ -161,13 +161,7 @@ def makoWrite(inpath, outpath, **args):
161161
makoFileList.append(outpath)
162162
return len(rendered.splitlines())
163163
except:
164-
traceback = RichTraceback()
165-
#for (filename, lineno, function, line) in traceback.traceback:
166-
# print("%s(%s) : error in %s" % (filename, lineno, function))
167-
# print(line, "\n")
168-
line = "%s: %s" % (str(traceback.error.__class__.__name__), traceback.error)
169-
makoErrorList.append(line)
170-
print(line)
164+
print(exceptions.text_error_template().render())
171165
raise
172166

173167
def makoFileListWrite(outpath):

0 commit comments

Comments
 (0)