Skip to content

Commit

Permalink
added early termination when configuration file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
XaverStiensmeier committed Sep 11, 2024
1 parent f855dc9 commit cef8040
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bibigrid/core/utility/handler/configuration_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import sys

import mergedeep
import yaml
Expand Down Expand Up @@ -31,8 +32,10 @@ def read_configuration(log, path, configuration_list=True):
configuration = yaml.safe_load(stream)
except yaml.YAMLError as exc:
log.warning("Couldn't read configuration %s: %s", path, exc)
sys.exit(1)
else:
log.warning("No such configuration file %s.", path)
sys.exit(1)
if configuration_list and not isinstance(configuration, list):
log.warning("Configuration should be list. Attempting to rescue by assuming a single configuration.")
return [configuration]
Expand Down

0 comments on commit cef8040

Please sign in to comment.