Skip to content

Commit 9714a10

Browse files
committed
fix error message
1 parent 21b820b commit 9714a10

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/vectorcode/database/chroma0.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,15 @@ async def get_client(self, configs: Config, need_lock: bool = True):
183183
process = await _start_server(configs)
184184
is_bundled = True
185185

186-
self.__clients[project_root] = _Chroma0ClientModel(
187-
client=await self._create_client(configs),
188-
is_bundled=is_bundled,
189-
process=process,
190-
)
186+
try:
187+
self.__clients[project_root] = _Chroma0ClientModel(
188+
client=await self._create_client(configs),
189+
is_bundled=is_bundled,
190+
process=process,
191+
)
192+
except httpx.RemoteProtocolError as e: # pragma: nocover
193+
e.add_note(f"Please verify that {url} is a working chromadb server.")
194+
raise
191195
lock = None
192196
if self.__clients[project_root].is_bundled and need_lock:
193197
lock = LockManager().get_lock(str(db_path))

src/vectorcode/main.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import sys
55
import traceback
66

7-
import httpx
8-
97
from vectorcode import __version__
108
from vectorcode.cli_utils import (
119
CliAction,
@@ -107,12 +105,8 @@ async def async_main():
107105
from vectorcode.subcommands import files
108106

109107
return_val = await files(final_configs)
110-
except Exception as e:
108+
except Exception:
111109
return_val = 1
112-
if isinstance(e, httpx.RemoteProtocolError): # pragma: nocover
113-
e.add_note(
114-
f"Please verify that {final_configs.db_url} is a working chromadb server."
115-
)
116110
logger.error(traceback.format_exc())
117111
finally:
118112
return return_val

0 commit comments

Comments
 (0)