Archived
1
0
Fork 0

fix logging of exceptions

This commit is contained in:
Lukas Winkler 2018-01-07 21:05:21 +01:00
parent 8c2011ab4a
commit faf043d037

12
main.py
View file

@ -51,13 +51,13 @@ if "sentry_url" in config and ("debug" not in config or not config["debug"]):
async def fetch(session, url):
async with session.get(url) as response:
try:
try:
async with session.get(url) as response:
return await response.text()
except Exception as e:
logging.exception("failed to fetch {url}".format(url=url))
if client is not None:
client.captureException()
except Exception as e:
logging.exception("failed to fetch {url}".format(url=url))
if 'client' in locals():
client.captureException(data={url:url})
async def main(loop, sites):