mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 01:40:21 +08:00
force exit on exception
This commit is contained in:
parent
04a8433dda
commit
3860beec84
14
main.py
14
main.py
@ -53,8 +53,8 @@ def read_item(request: LinkRequest):
|
||||
response: LinkResponse
|
||||
|
||||
# start_time = int(time.time() * 1000)
|
||||
try:
|
||||
with SB(uc=True, locale_code="en", test=False, xvfb=True, ad_block=True) as sb:
|
||||
with SB(uc=True, locale_code="en", test=False, xvfb=True, ad_block=True) as sb:
|
||||
try:
|
||||
sb: BaseCase
|
||||
sb.uc_open_with_reconnect(request.url)
|
||||
source = sb.get_page_source()
|
||||
@ -86,9 +86,13 @@ def read_item(request: LinkRequest):
|
||||
),
|
||||
startTimestamp=start_time,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error: {e}")
|
||||
raise HTTPException(status_code=500, detail="Unknown error, check logs") from e
|
||||
except Exception as e:
|
||||
logger.error(f"Error: {e}")
|
||||
if sb.driver:
|
||||
sb.driver.quit()
|
||||
raise HTTPException(
|
||||
status_code=500, detail="Unknown error, check logs"
|
||||
) from e
|
||||
|
||||
return response
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user