Skip to content

Commit

Permalink
feat: pretty print config errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aimxhaisse committed Nov 21, 2023
1 parent 0b27deb commit c0b5502
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions etc/config.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ relays: ~
liveness_file: ~

watched_keys:
- public_key: 0x832b8286f5d6535fd941c6c4ed8b9b20d214fc6aa726ce4fba1c9dbb4f278132646304f550e557231b6932aa02cf08d3
labels: ["google"]
- public_key: '0x832b8286f5d6535fd941c6c4ed8b9b20d214fc6aa726ce4fba1c9dbb4f278132646304f550e557231b6932aa02cf08d3'
labels: ['google']
fee_recipient: ~
8 changes: 6 additions & 2 deletions eth_validator_watcher/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import typer
from prometheus_client import Gauge, start_http_server
from typer import Option
from pydantic import ValidationError

from .beacon import Beacon
from .config import load_config, WatchedKeyConfig
Expand Down Expand Up @@ -136,7 +137,10 @@ def handler(
Prometheus server is automatically exposed on port 8000.
"""
cfg = load_config(config)
try:
cfg = load_config(config)
except ValidationError as err:
raise typer.BadParameter(f'Invalid configuration file: {err}')

Check warning on line 143 in eth_validator_watcher/entrypoint.py

View check run for this annotation

Codecov / codecov/patch

eth_validator_watcher/entrypoint.py#L140-L143

Added lines #L140 - L143 were not covered by tests

try: # pragma: no cover
_handler(
Expand All @@ -148,7 +152,7 @@ def handler(
cfg.slack_channel,
cfg.slack_token,
cfg.beacon_type,
cfg.relay_url,
cfg.relays,
cfg.liveness_file,
)
except KeyboardInterrupt: # pragma: no cover
Expand Down

0 comments on commit c0b5502

Please sign in to comment.