Exception: Droonga::MessageProcessingError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/droonga/message_processing_error.rb

Direct Known Subclasses

BadRequest, NotFound

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, detail = nil) ⇒ MessageProcessingError

Returns a new instance of MessageProcessingError.



20
21
22
23
# File 'lib/droonga/message_processing_error.rb', line 20

def initialize(message, detail=nil)
  @message = message
  @detail = detail
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail.



18
19
20
# File 'lib/droonga/message_processing_error.rb', line 18

def detail
  @detail
end

#messageObject (readonly)

Returns the value of attribute message.



18
19
20
# File 'lib/droonga/message_processing_error.rb', line 18

def message
  @message
end

Instance Method Details

#nameObject



25
26
27
# File 'lib/droonga/message_processing_error.rb', line 25

def name
  self.class.name.split("::").last
end

#response_bodyObject



33
34
35
36
37
38
39
40
# File 'lib/droonga/message_processing_error.rb', line 33

def response_body
  body = {
    "name"    => name,
    "message" => @message,
  }
  body["detail"] = @detail unless @detail.nil?
  body
end

#status_codeObject



29
30
31
# File 'lib/droonga/message_processing_error.rb', line 29

def status_code
  500
end