Sha256: f8df907019ce43318b36276c445b796814bba6e9f53d0e11203ce9ef67318c55

Contents?: true

Size: 699 Bytes

Versions: 6

Compression:

Stored size: 699 Bytes

Contents

module CopyleaksApi
  BasicError = Class.new(StandardError)
  BadCustomFieldError = Class.new(BasicError)
  BadFileError = Class.new(BasicError)
  BadEmailError = Class.new(BasicError)
  BadUrlError = Class.new(BasicError)
  UnknownLanguageError = Class.new(BasicError)

  class BadResponseError < BasicError
    attr_accessor :code

    # constructor
    def initialize(code, message)
      @code = code.to_i
      @message = message
    end

    def to_s
      "Error code: #{code}. #{@message}"
    end
  end

  class ManagedError < BadResponseError
    # returns true if this error is internal server error
    def internal_error?
      code == 16
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
plagiarism-checker-2.1.2 lib/copyleaks_api/errors.rb
plagiarism-checker-2.1.1 lib/copyleaks_api/errors.rb
plagiarism-checker-2.1.0 lib/copyleaks_api/errors.rb
plagiarism-checker-2.0.0 lib/copyleaks_api/errors.rb
plagiarism-checker-1.0.0 lib/copyleaks_api/errors.rb
mkisilenko-test-0.1.0 lib/copyleaks_api/errors.rb