diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-02-13 14:14:38 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-02-13 14:14:38 +0100 |
commit | 224683926624cf05d3441dae157de1a0ab68b973 (patch) | |
tree | ba4c1d46074059df9f21422465343f14288b244d /module/threads/DownloadThread.py | |
parent | Catch internal server errors on the right place. (diff) | |
download | pyload-224683926624cf05d3441dae157de1a0ab68b973.tar.xz |
catch server errors correctly
Diffstat (limited to 'module/threads/DownloadThread.py')
-rw-r--r-- | module/threads/DownloadThread.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/module/threads/DownloadThread.py b/module/threads/DownloadThread.py index 879dbf8bd..bd15b9b87 100644 --- a/module/threads/DownloadThread.py +++ b/module/threads/DownloadThread.py @@ -103,12 +103,6 @@ class DownloadThread(BaseThread): self.log.info(_("Download restarted: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": reason}) self.queue.put(pyfile) continue - except BadHeader, e: - if e.code == 500: - self.log.info(_("Internal Server Error")) - pyfile.error = _("Internal Server Error") - pyfile.plugin.tempOffline() - raise e except Fail, e: msg = e.args[0] @@ -185,10 +179,16 @@ class DownloadThread(BaseThread): continue - except Exception, e: - pyfile.setStatus("failed") - self.log.warning(_("Download failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": str(e)}) - pyfile.error = str(e) + except (Exception, BadHeader), e: + if isinstance(e, BadHeader) and e.code == 500: + pyfile.setStatus("temp. offline") + self.log.warning(_("Download is temporary offline: %s") % pyfile.name) + pyfile.error = _("Internal Server Error") + + else: + pyfile.setStatus("failed") + self.log.warning(_("Download failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": str(e)}) + pyfile.error = str(e) if self.core.debug: print_exc() |