lib/two_captcha/errors.rb in two_captcha-1.3.0 vs lib/two_captcha/errors.rb in two_captcha-1.3.1
- old
+ new
@@ -12,10 +12,22 @@
def initialize
super('The captcha is empty or invalid')
end
end
+ class Timeout < Error
+ def initialize
+ super('The captcha was not solved in the expected time')
+ end
+ end
+
+ class GoogleKey < Error
+ def initialize
+ super('Missing googlekey parameter')
+ end
+ end
+
class WrongUserKey < Error
def initialize
super('Wrong “key” parameter format, it should contain 32 symbols')
end
end
@@ -90,22 +102,34 @@
def initialize
super('No action passed')
end
end
- class Timeout < Error
+ class CaptchaImageBlocked < Error
def initialize
- super('The captcha was not solved in the expected time')
+ super('You have sent an image, that is unrecognizable and which is saved in our database as such. Usually this happens when the site where you get the captcha from has stopped sending you captcha and started giving you a “deny access” cap.')
end
end
- class GoogleKey < Error
+ class WrongCaptchaId < Error
def initialize
- super('Missing googlekey parameter')
+ super('You are trying to get the answer or complain a captcha that was submitted more than 15 minutes ago.')
end
end
+ class BadDuplicates < Error
+ def initialize
+ super('Error is returned when 100% accuracy feature is enabled. The error means that max numbers of tries is reached but min number of matches not found.')
+ end
+ end
+
+ class ReportNotRecorded < Error
+ def initialize
+ super('Error is returned to your complain request (reportbad) if you already complained lots of correctly solved captchas.')
+ end
+ end
+
RESPONSE_ERRORS = {
'ERROR_WRONG_USER_KEY' => TwoCaptcha::WrongUserKey,
'ERROR_KEY_DOES_NOT_EXIST' => TwoCaptcha::InvalidUserKey,
'ERROR_ZERO_BALANCE' => TwoCaptcha::ZeroBalance,
'ERROR_NO_SLOT_AVAILABLE' => TwoCaptcha::NoSlotAvailable,
@@ -116,8 +140,12 @@
'ERROR_IP_NOT_ALLOWED' => TwoCaptcha::IpNotAllowed,
'IP_BANNED' => TwoCaptcha::IpBanned,
'ERROR_WRONG_ID_FORMAT' => TwoCaptcha::WrongIdFormat,
'ERROR_CAPTCHA_UNSOLVABLE' => TwoCaptcha::CaptchaUnsolvable,
'ERROR_EMPTY_ACTION' => TwoCaptcha::EmptyAction,
- 'ERROR_GOOGLEKEY' => TwoCaptcha::GoogleKey
+ 'ERROR_GOOGLEKEY' => TwoCaptcha::GoogleKey,
+ 'ERROR_CAPTCHAIMAGE_BLOCKED' => TwoCaptcha::CaptchaImageBlocked,
+ 'ERROR_WRONG_CAPTCHA_ID' => TwoCaptcha::WrongCaptchaId,
+ 'ERROR_BAD_DUPLICATES' => TwoCaptcha::BadDuplicates,
+ 'REPORT_NOT_RECORDED' => TwoCaptcha::ReportNotRecorded,
}
end