Class: Droonga::Plugins::Error::Adapter
- Defined in:
- lib/droonga/plugins/error.rb
Instance Method Summary collapse
Methods inherited from Adapter
#adapt_input, id, input_message, output_message
Methods included from Droonga::Pluggable
Instance Method Details
#adapt_output(output_message) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/droonga/plugins/error.rb', line 27 def adapt_output() errors = .body["errors"] if errors and !errors.empty? .errors = errors status_codes = [] errors.values.each do |error| status_codes << error["statusCode"] end status_codes = status_codes.uniq if status_codes.size == 1 .status_code = status_codes.first else .status_code = ErrorMessages::InternalServerError::STATUS_CODE end .body = errors.values.first["body"] else .body.delete("errors") end end |