sources: catch generic errors from playwright

This commit is contained in:
Corentin Sechet 2022-04-11 15:28:57 +02:00
parent aa854141b9
commit 51253e4a37
1 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ from aiohttp import ClientConnectionError, ClientSession
from bs4 import BeautifulSoup
from playwright.async_api import (
BrowserContext,
Error,
Page,
Route,
TimeoutError,
@ -38,8 +39,12 @@ class Browser:
except TimeoutError:
if retry == 3:
self._source._error_summary.add_error(
f"Error while loading {url} : timeout, retried 3 times"
f"Timeout while loading {url} : retried 3 times, skipping"
)
except Error as ex:
self._source._error_summary.add_error(
f"Error while loading {url} : {ex}"
)
yield page
await page.close()