Exception: YogaPants::Client::ElasticSearchError

Inherits:
RequestError
  • Object
show all
Defined in:
lib/yoga_pants/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elasticsearch_error_message, original_exception) ⇒ ElasticSearchError

Returns a new instance of ElasticSearchError.



123
124
125
126
127
# File 'lib/yoga_pants/client.rb', line 123

def initialize(elasticsearch_error_message, original_exception)
  super(elasticsearch_error_message)
  set_backtrace(original_exception.backtrace)
  parse_and_set_elasticsearch_error_message(elasticsearch_error_message)
end

Instance Attribute Details

#elasticsearch_exception_detailsObject (readonly)

Returns the value of attribute elasticsearch_exception_details.



121
122
123
# File 'lib/yoga_pants/client.rb', line 121

def elasticsearch_exception_details
  @elasticsearch_exception_details
end

#elasticsearch_exception_nameObject (readonly)

Returns the value of attribute elasticsearch_exception_name.



120
121
122
# File 'lib/yoga_pants/client.rb', line 120

def elasticsearch_exception_name
  @elasticsearch_exception_name
end

Instance Method Details

#parse_and_set_elasticsearch_error_message(message) ⇒ Object



129
130
131
132
133
134
135
136
# File 'lib/yoga_pants/client.rb', line 129

def parse_and_set_elasticsearch_error_message(message)
  if message =~ /(\w+)\[(.+)\]/m
    @elasticsearch_exception_name = $1
    @elasticsearch_exception_details = $2
  else
    @elasticsearch_exception_name = message
  end
end