Exception: Elastic::AppSearch::ClientException
- Inherits:
-
StandardError
- Object
- StandardError
- Elastic::AppSearch::ClientException
- Defined in:
- lib/elastic/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
- #extract_messages(response) ⇒ Object
-
#initialize(response) ⇒ ClientException
constructor
A new instance of ClientException.
Constructor Details
#initialize(response) ⇒ ClientException
Returns a new instance of ClientException.
13 14 15 16 17 |
# File 'lib/elastic/app-search/exceptions.rb', line 13 def initialize(response) @errors = response.is_a?(Array) ? response.flat_map { |r| (r) } : (response) = (errors.size == 1) ? "Error: #{errors.first}" : "Errors: #{errors.inspect}" super() end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/elastic/app-search/exceptions.rb', line 4 def errors @errors end |
Instance Method Details
#extract_messages(response) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/elastic/app-search/exceptions.rb', line 6 def (response) errors_value = response['errors'] return errors_value if errors_value && errors_value.is_a?(Array) return [errors_value] if errors_value && !errors_value.is_a?(Array) [response] end |