Skip to content

Commit 85c220c

Browse files
committed
Expand error coverage and tests
1 parent e1e8deb commit 85c220c

File tree

6 files changed

+895
-64
lines changed

6 files changed

+895
-64
lines changed

redisvl/extensions/cache/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ async def _get_async_redis_client(self) -> AsyncRedisClient:
135135
url = str(self.redis_kwargs["redis_url"])
136136
kwargs = self.redis_kwargs.get("connection_kwargs", {})
137137
if not isinstance(kwargs, Mapping):
138-
raise ValueError(
139-
f"connection_kwargs must be a mapping, got {type(kwargs)}"
138+
raise TypeError(
139+
"Expected `connection_kwargs` to be a dictionary (e.g. {'decode_responses': True}), "
140+
f"but got type: {type(kwargs).__name__}"
140141
)
141142
self._async_redis_client = (
142143
RedisConnectionFactory.get_async_redis_connection(url, **kwargs)

redisvl/extensions/router/semantic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def from_existing(
137137

138138
router_dict = redis_client.json().get(f"{name}:route_config")
139139
if not isinstance(router_dict, dict):
140-
raise ValueError(f"No valid router config found for {name}")
140+
raise ValueError(
141+
f"No valid router config found for {name}. Received: {router_dict!r}"
142+
)
141143
return cls.from_dict(
142144
router_dict, redis_url=redis_url, redis_client=redis_client
143145
)

0 commit comments

Comments
 (0)