Exception: SwiftypeAppSearch::ClientException
- Inherits:
-
StandardError
- Object
- StandardError
- SwiftypeAppSearch::ClientException
- Defined in:
- lib/swiftype-app-search/exceptions.rb
Direct Known Subclasses
BadRequest, Forbidden, InvalidCredentials, InvalidDocument, NonExistentRecord, RequestEntityTooLarge, UnexpectedHTTPException
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(response) ⇒ ClientException
constructor
A new instance of ClientException.
Constructor Details
#initialize(response) ⇒ ClientException
Returns a new instance of ClientException.
5 6 7 8 9 10 11 12 13 |
# File 'lib/swiftype-app-search/exceptions.rb', line 5 def initialize(response) @errors = if response.is_a?(Array) response.flat_map { |r| r['errors'] } else response['errors'] || [response] end = (errors.count == 1) ? "Error: #{errors.first}" : "Errors: #{errors.inspect}" super() end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/swiftype-app-search/exceptions.rb', line 3 def errors @errors end |