mirror of
https://github.com/sjlongland/tornado-news.git
synced 2025-09-13 10:03:14 +10:00
Improve error reporting on failed fetch.
This commit is contained in:
parent
0e0e566756
commit
9acacf2a96
@ -242,10 +242,14 @@ class FeedFetcher(object):
|
||||
cached = False
|
||||
self._log.debug('Body type: %s (http)', type(body))
|
||||
except:
|
||||
self._log.debug('Body of failed fetch: %s', response.body)
|
||||
if cache_dir is not None:
|
||||
cache_file = path.join(cache_dir, 'body')
|
||||
if not path.isfile(cache_file):
|
||||
raise
|
||||
self._log.warning(
|
||||
'Failed to retrieve %s (%s), trying cache', name, url)
|
||||
body = open(path.join(cache_dir, 'body'),'rb').read()
|
||||
'Failed to retrieve %s (%s), trying cache', name, url, exc_info=1)
|
||||
body = open(cache_file,'rb').read()
|
||||
cached = True
|
||||
else:
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user