mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-26 02:50:03 +02:00
replaces ObservableDict key type warning with exception
This commit is contained in:
parent
208dee2b92
commit
ad4f926472
@ -239,11 +239,10 @@ class _ObservableDict(dict[str, Any], ObservableObject):
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
if not isinstance(key, str):
|
||||
logger.warning(
|
||||
"Dictionary key %s is not a string. Converting to string...",
|
||||
key,
|
||||
raise ValueError(
|
||||
f"Invalid key type: {key} ({type(key).__name__}). In pydase services, "
|
||||
"dictionary keys must be strings."
|
||||
)
|
||||
key = str(key)
|
||||
|
||||
if hasattr(self, "_observers"):
|
||||
self._remove_observer_if_observable(f'["{key}"]')
|
||||
|
Loading…
x
Reference in New Issue
Block a user