module Elastictastic::ServerError
Constants
- ERROR_PATTERN
- NESTED_PATTERN
Public Class Methods
[](server_message, status = nil)
click to toggle source
# File lib/elastictastic/server_error.rb, line 17 def [](server_message, status = nil) match = ERROR_PATTERN.match(server_message) if match if (nested_match = NESTED_PATTERN.match(match[2])) return self[nested_match[1], status] else clazz = Elastictastic::ServerError.const_get(match[1]) error = clazz.new(match[2]) error.status = status error end else Elastictastic::ServerError::ServerError.new(server_message) end end
const_missing(name)
click to toggle source
# File lib/elastictastic/server_error.rb, line 11 def const_missing(name) Class.new(::Elastictastic::ServerError::ServerError).tap do |error| const_set(name, error) end end