Put PlotError for the case of an incorrect inner layer.

This commit is contained in:
Salvador E. Tropea 2020-03-23 01:01:35 -03:00
parent 0a018e8b2b
commit e7d5accaa6
1 changed files with 25 additions and 16 deletions

View File

@ -31,6 +31,11 @@ except ImportError:
exit(misc.NO_PCBNEW_MODULE)
class PlotError(error.KiPlotError):
pass
def plot_error(msg):
logger.error(msg)
exit(misc.PLOT_ERROR)
@ -106,6 +111,7 @@ class Plotter(object):
self._configure_output_dir(pc, op)
try:
if self._output_is_layer(op):
self._do_layer_plot(board, pc, op, brd_file)
elif self._output_is_drill(op):
@ -120,6 +126,8 @@ class Plotter(object):
self._do_pcb_print(board, pc, op, brd_file)
else:
plot_error("Don't know how to plot type "+op.options.type)
except PlotError as e:
plot_error("In section '"+op.name+"' ("+op.options.type+"): "+str(e))
else:
logger.debug('Skipping %s output', op.name)
@ -290,7 +298,8 @@ class Plotter(object):
# for inner layers, we can now check if the layer exists
if layer.is_inner:
if layer.layer < 1 or layer.layer >= layer_cnt - 1:
plot_error("Inner layer {} is not valid for this board"
raise PlotError(
"Inner layer {} is not valid for this board"
.format(layer.layer))
# Set current layer