Skip to content

Commit

Permalink
config more elaborate error values
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Oct 16, 2024
1 parent 59226b9 commit ad6b624
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def load(self) -> C:
try:
return self._adapter.validate_python(self._values)
except ValidationError as exc:
error_details = "\n".join(str(e) for e in exc.errors())
raise InvalidConfigError(
"Something is wrong with the configuration file: \n"
f"Something is wrong with the configuration file: \n {error_details}"
) from exc
4 changes: 2 additions & 2 deletions tests/unit_tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
import yaml
from bluesky_stomp.models import BasicAuthentication
from pydantic import BaseModel, Field, Secret
from pydantic import BaseModel, Field

from blueapi.config import ApplicationConfig, ConfigLoader
from blueapi.utils import InvalidConfigError
Expand Down Expand Up @@ -251,7 +251,7 @@ def test_config_yaml_parsed(temp_yaml_config_file):
"stomp": {
"host": "localhost",
"port": 61613,
"auth": {"username": "guest", "password": Secret("guest")},
"auth": {"username": "guest", "password": "guest"},
},
"env": {
"sources": [
Expand Down

0 comments on commit ad6b624

Please sign in to comment.