Private GIT

Skip to content
Snippets Groups Projects
Commit d5c8664d authored by miigotu's avatar miigotu
Browse files

Simplify NN API error codes/descriptions and just use the description given by the provier

parent 5fb76f4f
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ from sickbeard import tvcache
from sickbeard import db
from sickbeard.common import Quality
from sickbeard.providers import generic
from sickrage.helper.encoding import ek
from sickrage.helper.encoding import ek, ss
from sickrage.show.Show import Show
from sickrage.helper.common import try_int
from sickbeard.common import USER_AGENT
......@@ -214,23 +214,16 @@ class NewznabProvider(generic.NZBProvider):
return self._checkAuth()
try:
err_code = int(data.error.attrs['code'])
err_desc = data.error.attrs['description']
if not (err_code or err_desc):
if not err_desc:
raise
except (AssertionError, AttributeError, ValueError):
return self._checkAuth()
if err_code == 100:
logger.log(u'Your API key for %s is incorrect, please check your config.' % self.name)
elif err_code == 101:
logger.log(u'Your account on %s has been suspended, contact the administrator.' % self.name)
elif err_code == 102:
logger.log(u'Your account is not allowed to use the API on %s, contact the administrator' % self.name)
elif err_code == 500:
logger.log(u'Your account for %s has reached the api limit' % self.name)
else:
logger.log(u'Unknown error: %s' % err_desc, logger.ERROR)
# This is all we should really need, the code is irrelevant
# Provider name is the thread name, and this should INFO,
# DEBUG hides from the user, WARNING nags the user, ERROR spams the tracker
logger.log(ss(err_desc))
return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment