Skip to content

Commit

Permalink
Unified some *dont_stop* cases
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Jan 5, 2024
1 parent 393f45f commit 2ba5b71
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 2 additions & 1 deletion kibot/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ def exit_with_error(msg, level, run_error=None, hints=None):
for h in hints:
if h[0] in out:
logger.error(h[1])
exit(level)
if level >= 0:
exit(level)

@staticmethod
def get_shape(shape):
Expand Down
12 changes: 3 additions & 9 deletions kibot/kiplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
EXIT_BAD_CONFIG, WRONG_INSTALL, UI_SMD, UI_VIRTUAL, TRY_INSTALL_CHECK, MOD_SMD, MOD_THROUGH_HOLE,
MOD_VIRTUAL, W_PCBNOSCH, W_NONEEDSKIP, W_WRONGCHAR, name2make, W_TIMEOUT, W_KIAUTO, W_VARSCH,
NO_SCH_FILE, NO_PCB_FILE, W_VARPCB, NO_YAML_MODULE, WRONG_ARGUMENTS, FAILED_EXECUTE, W_VALMISMATCH,
MOD_EXCLUDE_FROM_POS_FILES, MOD_EXCLUDE_FROM_BOM, MOD_BOARD_ONLY, hide_stderr, W_MAXDEPTH)
MOD_EXCLUDE_FROM_POS_FILES, MOD_EXCLUDE_FROM_BOM, MOD_BOARD_ONLY, hide_stderr, W_MAXDEPTH, DONT_STOP)
from .error import PlotError, KiPlotConfigurationError, config_error, KiPlotError
from .config_reader import CfgYamlReader
from .pre_base import BasePreFlight
Expand Down Expand Up @@ -454,10 +454,7 @@ def config_output(out, dry=False, dont_stop=False):
out.config(None)
except KiPlotConfigurationError as e:
msg = "In section '"+out.name+"' ("+out.type+"): "+str(e)
if dont_stop:
logger.error(msg)
else:
config_error(msg)
GS.exit_with_error(msg, DONT_STOP if dont_stop else EXIT_BAD_CONFIG)
ok = False
except SystemExit:
if not dont_stop:
Expand Down Expand Up @@ -497,10 +494,7 @@ def run_output(out, dont_stop=False):
config_error(msg)
except (PlotError, KiPlotError) as e:
msg = "In output `"+str(out)+"`: "+str(e)
if dont_stop:
logger.error(msg)
else:
GS.exit_with_error(msg, PLOT_ERROR)
GS.exit_with_error(msg, DONT_STOP if dont_stop else PLOT_ERROR)
except KiConfError as e:
ki_conf_error(e)
except SystemExit:
Expand Down
1 change: 1 addition & 0 deletions kibot/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


# Error levels
DONT_STOP = -1 # Keep going
INTERNAL_ERROR = 1 # Unhandled exceptions
WRONG_ARGUMENTS = 2 # This is what argsparse uses
UNSUPPORTED_OPTION = 3
Expand Down

0 comments on commit 2ba5b71

Please sign in to comment.