lib/grape/error_formatter/json.rb in grape-0.11.0 vs lib/grape/error_formatter/json.rb in grape-0.12.0
- old
+ new
@@ -3,10 +3,10 @@
module Json
class << self
def call(message, backtrace, options = {}, env = nil)
message = Grape::ErrorFormatter::Base.present(message, env)
- result = message.is_a?(Hash) ? message : { error: message }
+ result = message.is_a?(String) ? { error: message } : message
if (options[:rescue_options] || {})[:backtrace] && backtrace && !backtrace.empty?
result = result.merge(backtrace: backtrace)
end
MultiJson.dump(result)
end