From 80315fc611e03e0d7419d3d09e1d2c85986ed9b5 Mon Sep 17 00:00:00 2001 From: ThePhaseless Date: Sun, 17 Aug 2025 00:37:49 +0000 Subject: [PATCH] fix exception --- src/utils.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/utils.py b/src/utils.py index 550e0e6..f216caa 100644 --- a/src/utils.py +++ b/src/utils.py @@ -28,16 +28,22 @@ def get_sb( detail="SOCKS5 proxy with authentication is not supported. Check README for more info.", ) - with SB( - uc=True, - test=True, - headless=USE_HEADLESS, - xvfb=USE_XVFB, - locale_code="en", - ad_block=True, - proxy=proxy, - ) as sb: - yield sb + sb = None + try: + with SB( + uc=True, + test=True, + headless=USE_HEADLESS, + xvfb=USE_XVFB, + locale_code="en", + ad_block=True, + proxy=proxy, + ) as sb: + yield sb + except Exception: + # Log the exception but re-raise it to let FastAPI handle it properly + logger.exception("Exception in SeleniumBase dependency") + raise def save_screenshot(sb: BaseCase):