Skip to content

Commit ae09089

Browse files
author
Zhe Yu
committed
coverage for query
1 parent a1dd7cc commit ae09089

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/vectorcode/subcommands/query/__init__.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import logging
33
import os
4-
import sys
54

65
from chromadb import GetResult
76
from chromadb.api.models.AsyncCollection import AsyncCollection
@@ -127,7 +126,7 @@ async def build_query_results(
127126
)
128127

129128
structured_result.append(full_result)
130-
else:
129+
else: # pragma: nocover
131130
logger.error(
132131
"This collection doesn't support chunk-mode output because it lacks the necessary metadata. Please re-vectorise it.",
133132
)
@@ -154,21 +153,17 @@ async def query(configs: Config) -> int:
154153
if not verify_ef(collection, configs):
155154
return 1
156155
except (ValueError, InvalidCollectionException):
157-
print(
156+
logger.error(
158157
f"There's no existing collection for {configs.project_root}",
159-
file=sys.stderr,
160158
)
161159
return 1
162160
except InvalidDimensionException:
163-
print(
161+
logger.error(
164162
"The collection was embedded with a different embedding model.",
165-
file=sys.stderr,
166163
)
167164
return 1
168-
except IndexError:
169-
print(
170-
"Failed to get the collection. Please check your config.", file=sys.stderr
171-
)
165+
except IndexError: # pragma: nocover
166+
logger.error("Failed to get the collection. Please check your config.")
172167
return 1
173168

174169
if not configs.pipe:

0 commit comments

Comments
 (0)