Skip to content

Commit 597500a

Browse files
committed
Fixing error types
1 parent 7e63986 commit 597500a

File tree

4 files changed

+5
-73
lines changed

4 files changed

+5
-73
lines changed

async_search_client/_http_requests.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
Response,
1010
)
1111

12-
from async_search_client.errors import (
13-
MeiliSearchApiError,
14-
MeiliSearchCommunicationError,
15-
MeiliSearchTimeoutError,
16-
)
12+
from async_search_client.errors import MeiliSearchApiError, MeiliSearchCommunicationError
1713

1814

1915
class _HttpRequests:
@@ -40,7 +36,7 @@ async def _send_request(
4036
except ConnectError as err:
4137
raise MeiliSearchCommunicationError(str(err)) from err
4238
except ConnectTimeout as err:
43-
raise MeiliSearchTimeoutError(str(err)) from err
39+
raise MeiliSearchCommunicationError(str(err)) from err
4440
except HTTPError as err:
4541
raise MeiliSearchApiError(str(err), response) from err
4642

async_search_client/client.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ async def create_dump(self) -> DumpInfo:
5656
Raises:
5757
MeilisearchCommunicationError: If there was an error communicating with the server.
5858
MeilisearchApiError: If the MeiliSearch API returned an error.
59-
MeiliSearchTimeoutError: If the connection times out.
6059
"""
6160
response = await self._http_requests.post("dumps")
6261
return DumpInfo(**response.json())
@@ -74,7 +73,6 @@ async def create_index(self, uid: str, primary_key: Optional[str] = None) -> Ind
7473
Raises:
7574
MeilisearchCommunicationError: If there was an error communicating with the server.
7675
MeilisearchApiError: If the MeiliSearch API returned an error.
77-
MeiliSearchTimeoutError: If the connection times out.
7876
"""
7977
return await Index.create(self._http_client, uid, primary_key)
8078

@@ -90,7 +88,6 @@ async def delete_index_if_exists(self, uid: str) -> bool:
9088
Raises:
9189
MeilisearchCommunicationError: If there was an error communicating with the server.
9290
MeilisearchApiError: If the MeiliSearch API returned an error.
93-
MeiliSearchTimeoutError: If the connection times out.
9491
"""
9592
try:
9693
url = f"indexes/{uid}"
@@ -110,7 +107,6 @@ async def get_indexes(self) -> Optional[list[Index]]:
110107
Raises:
111108
MeilisearchCommunicationError: If there was an error communicating with the server.
112109
MeilisearchApiError: If the MeiliSearch API returned an error.
113-
MeiliSearchTimeoutError: If the connection times out.
114110
"""
115111
response = await self._http_requests.get("indexes")
116112

@@ -140,7 +136,6 @@ async def get_index(self, uid: str) -> Index:
140136
Raises:
141137
MeilisearchCommunicationError: If there was an error communicating with the server.
142138
MeilisearchApiError: If the MeiliSearch API returned an error.
143-
MeiliSearchTimeoutError: If the connection times out.
144139
"""
145140
return await Index(self._http_client, uid).fetch_info()
146141

@@ -158,7 +153,6 @@ def index(self, uid: str) -> Index:
158153
Raises:
159154
MeilisearchCommunicationError: If there was an error communicating with the server.
160155
MeilisearchApiError: If the MeiliSearch API returned an error.
161-
MeiliSearchTimeoutError: If the connection times out.
162156
"""
163157
return Index(self._http_client, uid=uid)
164158

@@ -172,7 +166,6 @@ async def get_all_stats(self) -> ClientStats:
172166
Raises:
173167
MeilisearchCommunicationError: If there was an error communicating with the server.
174168
MeilisearchApiError: If the MeiliSearch API returned an error.
175-
MeiliSearchTimeoutError: If the connection times out.
176169
"""
177170
response = await self._http_requests.get("stats")
178171
return ClientStats(**response.json())
@@ -190,7 +183,6 @@ async def get_dump_status(self, uid: str) -> DumpInfo:
190183
Raises:
191184
MeilisearchCommunicationError: If there was an error communicating with the server.
192185
MeilisearchApiError: If the MeiliSearch API returned an error.
193-
MeiliSearchTimeoutError: If the connection times out.
194186
"""
195187
url = f"dumps/{uid}/status"
196188
response = await self._http_requests.get(url)
@@ -229,7 +221,6 @@ async def get_keys(self) -> Keys:
229221
Raises:
230222
MeilisearchCommunicationError: If there was an error communicating with the server.
231223
MeilisearchApiError: If the MeiliSearch API returned an error.
232-
MeiliSearchTimeoutError: If the connection times out.
233224
"""
234225
response = await self._http_requests.get("keys")
235226
return Keys(**response.json())
@@ -246,7 +237,6 @@ async def get_raw_index(self, uid: str) -> Optional[IndexInfo]:
246237
Raises:
247238
MeilisearchCommunicationError: If there was an error communicating with the server.
248239
MeilisearchApiError: If the MeiliSearch API returned an error.
249-
MeiliSearchTimeoutError: If the connection times out.
250240
"""
251241
response = await self._http_client.get(f"indexes/{uid}")
252242

@@ -266,7 +256,6 @@ async def get_raw_indexes(self) -> Optional[list[IndexInfo]]:
266256
Raises:
267257
MeilisearchCommunicationError: If there was an error communicating with the server.
268258
MeilisearchApiError: If the MeiliSearch API returned an error.
269-
MeiliSearchTimeoutError: If the connection times out.
270259
"""
271260
response = await self._http_requests.get("indexes")
272261

@@ -284,7 +273,6 @@ async def get_version(self) -> Version:
284273
Raises:
285274
MeilisearchCommunicationError: If there was an error communicating with the server.
286275
MeilisearchApiError: If the MeiliSearch API returned an error.
287-
MeiliSearchTimeoutError: If the connection times out.
288276
"""
289277
response = await self._http_requests.get("version")
290278
return Version(**response.json())
@@ -298,7 +286,6 @@ async def health(self) -> Health:
298286
Raises:
299287
MeilisearchCommunicationError: If there was an error communicating with the server.
300288
MeilisearchApiError: If the MeiliSearch API returned an error.
301-
MeiliSearchTimeoutError: If the connection times out.
302289
"""
303290
response = await self._http_requests.get("health")
304291
return Health(**response.json())

0 commit comments

Comments
 (0)