Skip to content

Commit

Permalink
adjust error message and exception chain
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhutcherson committed Oct 2, 2024
1 parent fd5d73a commit 094600d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion redisvl/index/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ async def from_existing(

# Validate modules
installed_modules = await RedisConnectionFactory.get_modules_async(redis_client)

try:
required_modules = [
{"name": "search", "ver": 20810},
Expand All @@ -880,7 +881,7 @@ async def from_existing(
except RedisModuleVersionError as e:
raise RedisModuleVersionError(
f"Loading from existing index failed. {str(e)}"
)
) from e

# Fetch index info and convert to schema
index_info = await cls._info(name, redis_client)
Expand Down
11 changes: 5 additions & 6 deletions redisvl/redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,13 @@ def validate_modules(
if int(installed_version) >= int(required_module["ver"]): # type: ignore
return

error_message = "Required Redis db module "

error_message += " OR ".join(
# Build the error message dynamically
required_modules_str = " OR ".join(
[f'{module["name"]} >= {module["ver"]}' for module in required_modules]
)

error_message += (
" not installed. See Redis Stack docs at https://redis.io/docs/stack/."
error_message = (
f"Required Redis db module {required_modules_str} not installed. "
"See Redis Stack docs at https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/."
)

raise RedisModuleVersionError(error_message)
Expand Down

0 comments on commit 094600d

Please sign in to comment.