Sha256: 3dcac03f762a07a0914a21eae27eebd6bb7066f55ab6ea6577e98864a07d5c1b
Contents?: true
Size: 768 Bytes
Versions: 2
Compression:
Stored size: 768 Bytes
Contents
module SwiftypeAppSearch class ClientException < StandardError attr_reader :errors def initialize(response) @errors = response['errors'] || [ response ] message = (errors.count == 1) ? "Error: #{errors.first}" : "Errors: #{errors.inspect}" super(message) end end class NonExistentRecord < ClientException; end class InvalidCredentials < ClientException; end class BadRequest < ClientException; end class Forbidden < ClientException; end class InvalidDocument < ClientException; end class RequestEntityTooLarge < ClientException; end class UnexpectedHTTPException < ClientException def initialize(http_response) @errors = [] super("HTTP #{http_response.code}: #{http_response.body}") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
swiftype-app-search-0.1.2 | lib/swiftype-app-search/exceptions.rb |
swiftype-app-search-0.1.1 | lib/swiftype-app-search/exceptions.rb |