move bugtraps to avoid silence of bugs in media_downloaded or media_failed

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40236
This commit is contained in:
Daniel Grana 2008-09-15 12:46:34 +00:00
parent ca695c8c79
commit 4944762341
1 changed files with 5 additions and 5 deletions

View File

@ -36,7 +36,7 @@ class MediaPipeline(object):
'get_urls_from_item should return None or iterable'
def _bugtrap(_failure, request):
log.msg('MediaPipeline Unhandled ERROR in %s: %s' % (request, _failure), log.ERROR, domain=domain)
log.msg('Unhandled ERROR in MediaPipeline.{new,failed}_item_media for %s: %s' % (request, _failure), log.ERROR, domain=domain)
lst = []
for url in urls or ():
@ -72,9 +72,6 @@ class MediaPipeline(object):
return wad
def _download(self, request, info, fp):
def _bugtrap(_failure, request):
log.msg('MediaPipeline Unhandled ERROR in %s: %s' % (request, _failure), log.ERROR, domain=info.domain)
dwld = mustbe_deferred(self.download, request, info)
dwld.addCallbacks(
callback=self.media_downloaded,
@ -82,10 +79,13 @@ class MediaPipeline(object):
errback=self.media_failure,
errbackArgs=(request, info),
)
dwld.addErrback(_bugtrap, request)
dwld.addBoth(self._downloaded, info, fp)
info.downloading[fp] = (request, dwld)
def _bugtrap(_failure):
log.msg('Unhandled ERROR in MediaPipeline._downloaded: %s' % (_failure), log.ERROR, domain=info.domain)
dwld.errback(_bugtrap)
def _downloaded(self, result, info, fp):
info.downloaded[fp] = result # cache result