diff options
author | Pedro Algarvio <pedro@algarvio.me> | 2012-02-13 13:56:40 +0100 |
---|---|---|
committer | Pedro Algarvio <pedro@algarvio.me> | 2012-02-13 13:56:40 +0100 |
commit | ebe0e6039d822e9c16a6095dba8691066bc3b466 (patch) | |
tree | a7b04c302262badc0d96deb7c146dc3c32e60a11 | |
parent | Add the internal server error messages to the pyfile. (diff) | |
download | pyload-ebe0e6039d822e9c16a6095dba8691066bc3b466.tar.xz |
Catch internal server errors on the right place.
-rw-r--r-- | module/plugins/Hoster.py | 11 | ||||
-rw-r--r-- | module/threads/DownloadThread.py | 10 |
2 files changed, 9 insertions, 12 deletions
diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 1f21a27c8..05f55ebc8 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -161,16 +161,7 @@ class Hoster(Base): self.pyfile.setStatus("starting") - try: - return self.process(self.pyfile) - except Exception, e: - # Can't seem to import BadHeader - if e.__class__.__name__ == 'BadHeader' and e.code == 500: - self.logInfo("Internal Server Error") - self.pyfile.error = _("Internal Server Error") - self.tempOffline() - raise e - + return self.process(self.pyfile) def process(self, pyfile): """the 'main' method of every plugin, you **have to** overwrite it""" diff --git a/module/threads/DownloadThread.py b/module/threads/DownloadThread.py index c151831a3..879dbf8bd 100644 --- a/module/threads/DownloadThread.py +++ b/module/threads/DownloadThread.py @@ -26,6 +26,7 @@ from pycurl import error from module.plugins.Base import Fail, Retry from module.plugins.Hoster import Abort, Reconnect, SkipDownload +from module.network.HTTPRequest import BadHeader from BaseThread import BaseThread @@ -102,7 +103,12 @@ 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] @@ -212,4 +218,4 @@ class DownloadThread(BaseThread): def stop(self): """stops the thread""" - self.put("quit")
\ No newline at end of file + self.put("quit") |