Skip to content

Commit c4dfbb4

Browse files
authored
Re-raising original exception in clinical_trials tools (#1038)
1 parent ad16646 commit c4dfbb4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/paperqa/sources/clinical_trials.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from aiohttp.web import HTTPBadRequest
1010
from lmi.utils import gather_with_concurrency
1111
from tenacity import (
12+
before_sleep_log,
1213
retry,
1314
retry_if_exception_type,
1415
stop_after_attempt,
@@ -48,6 +49,8 @@ def filter(self, record):
4849
stop=stop_after_attempt(3),
4950
wait=wait_incrementing(0.1, 0.1),
5051
retry=retry_if_exception_type(ClientResponseError),
52+
before_sleep=before_sleep_log(logger, logging.WARNING),
53+
reraise=True,
5154
)
5255
async def api_search_clinical_trials(query: str, session: ClientSession) -> dict:
5356

@@ -74,6 +77,8 @@ async def api_search_clinical_trials(query: str, session: ClientSession) -> dict
7477
@retry(
7578
stop=stop_after_attempt(3),
7679
wait=wait_incrementing(0.1, 0.1),
80+
before_sleep=before_sleep_log(logger, logging.WARNING),
81+
reraise=True,
7782
)
7883
async def api_get_clinical_trial(nct_id: str, session: ClientSession) -> dict | None:
7984
with logging_filters(loggers={"aiohttp.client"}, filters={CookieWarningFilter}):

0 commit comments

Comments
 (0)