1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-28 10:38:26 +00:00
bazarr/libs/python_anticaptcha/exceptions.py
2019-04-06 08:26:42 -04:00

23 lines
952 B
Python

class AnticaptchaException(Exception):
def __init__(self, error_id, error_code, error_description, *args):
super(AnticaptchaException, self).__init__("[{}:{}]{}".format(error_code, error_id, error_description))
self.error_description = error_description
self.error_id = error_id
self.error_code = error_code
AnticatpchaException = AnticaptchaException
class InvalidWidthException(AnticaptchaException):
def __init__(self, width):
self.width = width
msg = 'Invalid width (%s). Can be one of these: 100, 50, 33, 25.' % (self.width,)
super(InvalidWidthException, self).__init__("AC-1", 1, msg)
class MissingNameException(AnticaptchaException):
def __init__(self, cls):
self.cls = cls
msg = 'Missing name data in {0}. Provide {0}.__init__(name="X") or {0}.serialize(name="X")'.format(str(self.cls))
super(MissingNameException, self).__init__("AC-2", 2, msg)