diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/Plugin.py | 14 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 4 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleHoster.py | 4 | 
3 files changed, 14 insertions, 8 deletions
| diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index be26a8960..8e66dff6c 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -309,10 +309,17 @@ class Plugin(Base):          raise Fail(reason) -    def error(self, reason=None, type="parse"): -        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) +    def error(self, reason="", type=""): +        if not reason and not type: +            type = "unknown" + +        msg  = "%s error" % type.strip().capitalize() if type else "Error" +        msg += ": " + reason.strip() if reason else "" +        msg += " | Plugin may be out of date" +          if self.core.debug:              print_exc() +        raise Fail(msg)      def offline(self): @@ -333,8 +340,7 @@ class Plugin(Base):          :param reason: reason for retrying, will be passed to fail if max_tries reached          """          if 0 < max_tries <= self.retries: -            if not reason: reason = "Max retries reached" -            raise Fail(reason) +            self.error(reason or "Max retries reached", "retry")          self.wantReconnect = False          self.setWait(wait_time) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 6c00a2267..402a641ea 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -165,7 +165,7 @@ class SimpleCrypter(Crypter):      #@TODO: remove in 0.4.10 -    def error(self, reason=None, type="parse"): -        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) +    def error(self, reason="", type="parse"):          if self.core.debug:              print_exc() +        raise Fail("%s error%s | Plugin may be out of date" % (type.strip().capitalize(), ': ' + reason.strip() if reason else "")) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index a8a44d953..be3e3c8fc 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -323,7 +323,7 @@ class SimpleHoster(Hoster):      #@TODO: remove in 0.4.10 -    def error(self, reason=None, type="parse"): -        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ': ' + str(reason) if reason else "")) +    def error(self, reason="", type="parse"):          if self.core.debug:              print_exc() +        raise Fail("%s error%s | Plugin may be out of date" % (type.strip().capitalize(), ': ' + reason.strip() if reason else "")) | 
