Skip to content

Commit

Permalink
chg: Catch more errors, improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Apr 19, 2024
1 parent b3209aa commit 9f08891
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions playwrightcapture/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,6 @@ async def store_request(request: Request) -> None:
except Exception:
raise e
else:
if not self._exception_is_network_error(initial_error):
# TODO: Do something?
self.logger.warning(f'Unexpected error: {initial_error}')
raise initial_error
else:
await page.bring_to_front()
Expand Down Expand Up @@ -887,7 +884,11 @@ async def store_request(request: Request) -> None:
'Navigation failed because page was closed!',
'Protocol error (Page.bringToFront): Not attached to an active page',
'Peer failed to perform TLS handshake: The TLS connection was non-properly terminated.',
'Load cannot follow more than 20 redirections']:
'Peer failed to perform TLS handshake: Error sending data: Connection reset by peer',
'Peer sent fatal TLS alert: The server name sent was not recognized',
'Load cannot follow more than 20 redirections',
'Page crashed',
'Error receiving data: Connection reset by peer']:
# Other errors, let's give it another shot
self.logger.info(f'Issue with {url} (retrying): {e.message}')
self.should_retry = True
Expand Down

0 comments on commit 9f08891

Please sign in to comment.