Skip to content

Commit

Permalink
Log stack trace when restarting fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Nov 20, 2024
1 parent f9af908 commit 2e3ef1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import sys
import tempfile
import time
import traceback

from fnmatch import fnmatch
from pprint import pformat
Expand Down Expand Up @@ -983,11 +984,12 @@ def restart_browser(self):
self.logger.info("Successfully restarted")
break
except Exception as e:
self.logger.error("Error restarting browser. Retrying ...")
if isinstance(e, WebDriverException):
self.logger.error('%s: %s', type(e).__name__, e.msg)
else:
self.logger.error('%s: %s', type(e).__name__, e)
self.logger.error(traceback.format_exc())
self.logger.error("Error restarting browser. Retrying ...")
else:
# If we couldn't restart the browser after all that, just quit.
self.logger.error("Could not restart browser")
Expand Down

0 comments on commit 2e3ef1c

Please sign in to comment.