Skip to content

Commit

Permalink
Config: Clearer error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
xsedla1o committed Jul 4, 2023
1 parent 30eed7b commit 576c79b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dp3/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import threading
from importlib import import_module

from pydantic import ValidationError

from dp3.common.callback_registrar import CallbackRegistrar
from dp3.common.config import PlatformConfig
from dp3.common.control import Control, ControlAction
Expand Down Expand Up @@ -126,7 +128,11 @@ def main(app_name: str, config_dir: str, process_index: int, verbose: bool) -> N

# Whole configuration should be loaded
config = read_config_dir(config_base_path, recursive=True)
model_spec = ModelSpec(config.get("db_entities"))
try:
model_spec = ModelSpec(config.get("db_entities"))
except ValidationError as e:
log.fatal("Invalid model specification: %s", e)
sys.exit(2)

# Print whole attribute specification
log.debug(model_spec)
Expand Down

0 comments on commit 576c79b

Please sign in to comment.