Added stack trace for the SCH loading.
Only when debug enabled.
This commit is contained in:
parent
d26c9a39bd
commit
0503d9ef7d
|
|
@ -23,10 +23,14 @@ class KiPlotConfigurationError(KiPlotError):
|
|||
pass
|
||||
|
||||
|
||||
def config_error(msg):
|
||||
def trace_dump():
|
||||
if GS.debug_enabled:
|
||||
logger.error('Trace stack:')
|
||||
(type, value, traceback) = exc_info()
|
||||
print_tb(traceback)
|
||||
|
||||
|
||||
def config_error(msg):
|
||||
trace_dump()
|
||||
logger.error(msg)
|
||||
exit(EXIT_BAD_CONFIG)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from importlib.util import (spec_from_file_location, module_from_spec)
|
|||
from .gs import (GS)
|
||||
from .misc import (PLOT_ERROR, NO_PCBNEW_MODULE, MISSING_TOOL, CMD_EESCHEMA_DO, URL_EESCHEMA_DO, CORRUPTED_PCB,
|
||||
EXIT_BAD_ARGS, CORRUPTED_SCH)
|
||||
from .error import (PlotError, KiPlotConfigurationError, config_error)
|
||||
from .error import PlotError, KiPlotConfigurationError, config_error, trace_dump
|
||||
from .pre_base import BasePreFlight
|
||||
from .kicad.v5_sch import Schematic, SchFileError
|
||||
from . import log
|
||||
|
|
@ -127,6 +127,7 @@ def load_sch():
|
|||
GS.sch.load(GS.sch_file)
|
||||
GS.sch.load_libs(GS.sch_file)
|
||||
except SchFileError as e:
|
||||
trace_dump()
|
||||
logger.error('At line {} of `{}`: {}'.format(e.args[2], GS.sch_file, e.args[0]))
|
||||
logger.error('Line content: `{}`'.format(e.args[1]))
|
||||
exit(CORRUPTED_SCH)
|
||||
|
|
|
|||
Loading…
Reference in New Issue