gcode_macro: Provide more information on a formatting error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b112cac47a
commit
de7c1f76db
|
@ -3,7 +3,7 @@
|
||||||
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
import logging
|
import traceback, logging
|
||||||
|
|
||||||
DEFAULT_PREFIX = 'default_parameter_'
|
DEFAULT_PREFIX = 'default_parameter_'
|
||||||
|
|
||||||
|
@ -31,8 +31,9 @@ class GCodeMacro:
|
||||||
kwparams.update(params)
|
kwparams.update(params)
|
||||||
try:
|
try:
|
||||||
script = self.script.format(**kwparams)
|
script = self.script.format(**kwparams)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
msg = "Macro %s script formatting failed" % (self.alias,)
|
msg = "Error evaluating %s: %s" % (
|
||||||
|
self.alias, traceback.format_exception_only(type(e), e)[-1])
|
||||||
logging.exception(msg)
|
logging.exception(msg)
|
||||||
raise self.gcode.error(msg)
|
raise self.gcode.error(msg)
|
||||||
self.in_script = True
|
self.in_script = True
|
||||||
|
|
Loading…
Reference in New Issue