mirror of
https://github.com/andreili/klipper.git
synced 2025-08-24 03:44:06 +02:00
gcode_macro: Expand template syntax errors (#6839)
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
parent
3e7efe5ef1
commit
b50d740542
@ -49,6 +49,12 @@ class TemplateWrapper:
|
|||||||
self.create_template_context = gcode_macro.create_template_context
|
self.create_template_context = gcode_macro.create_template_context
|
||||||
try:
|
try:
|
||||||
self.template = env.from_string(script)
|
self.template = env.from_string(script)
|
||||||
|
except jinja2.exceptions.TemplateSyntaxError as e:
|
||||||
|
lines = script.splitlines()
|
||||||
|
msg = "Error loading template '%s'\nline %s: %s # %s" % (
|
||||||
|
name, e.lineno, lines[e.lineno-1], e.message)
|
||||||
|
logging.exception(msg)
|
||||||
|
raise self.gcode.error(msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = "Error loading template '%s': %s" % (
|
msg = "Error loading template '%s': %s" % (
|
||||||
name, traceback.format_exception_only(type(e), e)[-1])
|
name, traceback.format_exception_only(type(e), e)[-1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user