module TwoCaptcha.Internal.Types.Exception where
import Control.Exception (Exception)
import Data.Functor (($>))
import Data.Text (Text)
import Network.HTTP.Client (HttpException)
import Text.Parsec (ParseError, parse, try, (<|>))
import Text.Parsec.Char (string)
import Text.Parsec.String (Parser)
data TwoCaptchaException
=
TwoCaptchaResponseException TwoCaptchaErrorCode
|
NetworkException HttpException
|
UnknownError Text
|
SolvingTimeout
deriving (Int -> TwoCaptchaException -> ShowS
[TwoCaptchaException] -> ShowS
TwoCaptchaException -> String
(Int -> TwoCaptchaException -> ShowS)
-> (TwoCaptchaException -> String)
-> ([TwoCaptchaException] -> ShowS)
-> Show TwoCaptchaException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TwoCaptchaException] -> ShowS
$cshowList :: [TwoCaptchaException] -> ShowS
show :: TwoCaptchaException -> String
$cshow :: TwoCaptchaException -> String
showsPrec :: Int -> TwoCaptchaException -> ShowS
$cshowsPrec :: Int -> TwoCaptchaException -> ShowS
Show)
instance Exception TwoCaptchaException
data TwoCaptchaErrorCode
=
WrongUserKey
|
KeyDoesNotExist
|
ZeroBalance
|
PageUrlMissing
|
NoSlotAvailable
|
ZeroCaptchaFileSize
|
TooBigCaptchaFileSize
|
WrongFileExtension
|
ImageTypeNotSupported
|
UploadFailure
|
IpNotAllowed
|
IpBanned
|
BadTokenOrPageUrl
|
GoogleKeyInvalid
|
GoogleKeyMissing
|
CaptchaImageBlocked
|
TooManyBadImages
|
RateLimited
|
Error1001
|
Error1002
|
Error1003
|
Error1004
|
Error1005
|
BadParameters
|
BadProxy
|
CaptchaNotReady
|
CaptchaUnsolvable
|
WrongIdFormat
|
WrongCaptchaId
|
BadDuplicates
|
ReportNotRecorded
|
DuplicateReport
|
InvalidPingbackIp
|
TokenExpired
|
EmptyAction
|
ProxyConnectionFailed
deriving (Int -> TwoCaptchaErrorCode -> ShowS
[TwoCaptchaErrorCode] -> ShowS
TwoCaptchaErrorCode -> String
(Int -> TwoCaptchaErrorCode -> ShowS)
-> (TwoCaptchaErrorCode -> String)
-> ([TwoCaptchaErrorCode] -> ShowS)
-> Show TwoCaptchaErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TwoCaptchaErrorCode] -> ShowS
$cshowList :: [TwoCaptchaErrorCode] -> ShowS
show :: TwoCaptchaErrorCode -> String
$cshow :: TwoCaptchaErrorCode -> String
showsPrec :: Int -> TwoCaptchaErrorCode -> ShowS
$cshowsPrec :: Int -> TwoCaptchaErrorCode -> ShowS
Show, TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool
(TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool)
-> (TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool)
-> Eq TwoCaptchaErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool
$c/= :: TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool
== :: TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool
$c== :: TwoCaptchaErrorCode -> TwoCaptchaErrorCode -> Bool
Eq)
errorCode :: TwoCaptchaErrorCode -> String
errorCode :: TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
WrongUserKey = String
"ERROR_WRONG_USER_KEY"
errorCode TwoCaptchaErrorCode
KeyDoesNotExist = String
"ERROR_KEY_DOES_NOT_EXIST"
errorCode TwoCaptchaErrorCode
ZeroBalance = String
"ERROR_ZERO_BALANCE"
errorCode TwoCaptchaErrorCode
PageUrlMissing = String
"ERROR_PAGEURL"
errorCode TwoCaptchaErrorCode
NoSlotAvailable = String
"ERROR_NO_SLOT_AVAILABLE"
errorCode TwoCaptchaErrorCode
ZeroCaptchaFileSize = String
"ERROR_ZERO_CAPTCHA_FILESIZE"
errorCode TwoCaptchaErrorCode
TooBigCaptchaFileSize = String
"ERROR_TOO_BIG_CAPTCHA_FILESIZE"
errorCode TwoCaptchaErrorCode
WrongFileExtension = String
"ERROR_WRONG_FILE_EXTENSION"
errorCode TwoCaptchaErrorCode
ImageTypeNotSupported = String
"ERROR_IMAGE_TYPE_NOT_SUPPORTED"
errorCode TwoCaptchaErrorCode
UploadFailure = String
"ERROR_UPLOAD"
errorCode TwoCaptchaErrorCode
IpNotAllowed = String
"ERROR_IP_NOT_ALLOWED"
errorCode TwoCaptchaErrorCode
IpBanned = String
"IP_BANNED"
errorCode TwoCaptchaErrorCode
BadTokenOrPageUrl = String
"ERROR_BAD_TOKEN_OR_PAGEURL"
errorCode TwoCaptchaErrorCode
GoogleKeyInvalid = String
"ERROR_GOOGLEKEY"
errorCode TwoCaptchaErrorCode
GoogleKeyMissing = String
"ERROR_WRONG_GOOGLEKEY"
errorCode TwoCaptchaErrorCode
CaptchaImageBlocked = String
"ERROR_CAPTCHAIMAGE_BLOCKED"
errorCode TwoCaptchaErrorCode
TooManyBadImages = String
"TOO_MANY_BAD_IMAGES"
errorCode TwoCaptchaErrorCode
RateLimited = String
"MAX_USER_TURN"
errorCode TwoCaptchaErrorCode
Error1001 = String
"ERROR: 1001"
errorCode TwoCaptchaErrorCode
Error1002 = String
"ERROR: 1002"
errorCode TwoCaptchaErrorCode
Error1003 = String
"ERROR: 1003"
errorCode TwoCaptchaErrorCode
Error1004 = String
"ERROR: 1004"
errorCode TwoCaptchaErrorCode
Error1005 = String
"ERROR: 1005"
errorCode TwoCaptchaErrorCode
BadParameters = String
"ERROR_BAD_PARAMETERS"
errorCode TwoCaptchaErrorCode
BadProxy = String
"ERROR_BAD_PROXY"
errorCode TwoCaptchaErrorCode
CaptchaNotReady = String
"CAPCHA_NOT_READY"
errorCode TwoCaptchaErrorCode
CaptchaUnsolvable = String
"ERROR_CAPTCHA_UNSOLVABLE"
errorCode TwoCaptchaErrorCode
WrongIdFormat = String
"ERROR_WRONG_ID_FORMAT"
errorCode TwoCaptchaErrorCode
WrongCaptchaId = String
"ERROR_WRONG_CAPTCHA_ID"
errorCode TwoCaptchaErrorCode
BadDuplicates = String
"ERROR_BAD_DUPLICATES"
errorCode TwoCaptchaErrorCode
ReportNotRecorded = String
"ERROR_REPORT_NOT_RECORDED"
errorCode TwoCaptchaErrorCode
DuplicateReport = String
"ERROR_DUPLICATE_REPORT"
errorCode TwoCaptchaErrorCode
InvalidPingbackIp = String
"ERROR_IP_ADDRES"
errorCode TwoCaptchaErrorCode
TokenExpired = String
"ERROR_TOKEN_EXPIRED"
errorCode TwoCaptchaErrorCode
EmptyAction = String
"ERROR_EMPTY_ACTION"
errorCode TwoCaptchaErrorCode
ProxyConnectionFailed = String
"ERROR_PROXY_CONNECTION_FAILED"
errorParser :: Parser TwoCaptchaErrorCode
errorParser :: Parser TwoCaptchaErrorCode
errorParser =
Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
WrongUserKey) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
WrongUserKey)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
KeyDoesNotExist) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
KeyDoesNotExist)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
ZeroBalance) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
ZeroBalance)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
PageUrlMissing) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
PageUrlMissing)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
NoSlotAvailable) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
NoSlotAvailable)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
ZeroCaptchaFileSize) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
ZeroCaptchaFileSize)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
TooBigCaptchaFileSize) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TooBigCaptchaFileSize)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
WrongFileExtension) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
WrongFileExtension)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
ImageTypeNotSupported) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
ImageTypeNotSupported)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
UploadFailure) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
UploadFailure)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
IpNotAllowed) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
IpNotAllowed)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
IpBanned) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
IpBanned)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
BadTokenOrPageUrl) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
BadTokenOrPageUrl)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
GoogleKeyInvalid) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
GoogleKeyInvalid)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
GoogleKeyMissing) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
GoogleKeyMissing)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
CaptchaImageBlocked) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
CaptchaImageBlocked)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
TooManyBadImages) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TooManyBadImages)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
RateLimited) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
RateLimited)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
Error1001) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
Error1001)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
Error1002) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
Error1002)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
Error1003) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
Error1003)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
Error1004) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
Error1004)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
Error1005) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
Error1005)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
BadParameters) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
BadParameters)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
BadProxy) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
BadProxy)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
CaptchaNotReady) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
CaptchaNotReady)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
CaptchaUnsolvable) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
CaptchaUnsolvable)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
WrongIdFormat) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
WrongIdFormat)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
WrongCaptchaId) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
WrongCaptchaId)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
BadDuplicates) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
BadDuplicates)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
ReportNotRecorded) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
ReportNotRecorded)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
DuplicateReport) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
DuplicateReport)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
InvalidPingbackIp) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
InvalidPingbackIp)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
TokenExpired) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TokenExpired Parser TwoCaptchaErrorCode
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TokenExpired Parser TwoCaptchaErrorCode
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TokenExpired Parser TwoCaptchaErrorCode
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
TokenExpired)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
EmptyAction) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
EmptyAction)
Parser TwoCaptchaErrorCode
-> Parser TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String -> ParsecT String () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string (TwoCaptchaErrorCode -> String
errorCode TwoCaptchaErrorCode
ProxyConnectionFailed) ParsecT String () Identity String
-> TwoCaptchaErrorCode -> Parser TwoCaptchaErrorCode
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> TwoCaptchaErrorCode
ProxyConnectionFailed
readErrorCode :: String -> Either ParseError TwoCaptchaErrorCode
readErrorCode :: String -> Either ParseError TwoCaptchaErrorCode
readErrorCode = Parser TwoCaptchaErrorCode
-> String -> String -> Either ParseError TwoCaptchaErrorCode
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
parse Parser TwoCaptchaErrorCode
errorParser String
""