Sha256: 6b8c9282dfe52a5e32738e494e262e2930f7c3ec9033791edd810095c25c000c

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module ZeroCaptcha
  # This is the base DeathByCaptcha exception class. Rescue it if you want to
  # catch any exception that might be raised.
  #
  class Error < Exception
  end

  class ArgumentError < Error
  end

  class InvalidCaptcha < Error
    def initialize
      super('The captcha is empty or invalid')
    end
  end

  class InvalidCaptchaType < Error
    def initialize
      super('Captcha type is invalid or cannot be solved by ZeroCaptcha')
    end
  end

  class Timeout < Error
    def initialize
      super('The captcha was not solved in the expected time')
    end
  end

  class IncorrectSolution < Error
    def initialize
      super('The captcha could not be solved correctly')
    end
  end

  class APIForbidden < Error
    def initialize
      super('Access denied, please check your credentials and/or balance')
    end
  end

  class APIBadRequest < Error
    def initialize
      super('The Captcha was rejected, check if it\'s a valid image')
    end
  end

  class APIResponseError < Error
    def initialize(info)
      super("Invalid API response: #{info}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zero_captcha-1.0.0 lib/zero_captcha/errors.rb