Module: BOILERPLATE::ErrorFormatter

Defined in:
lib/grape/cli/boilerplate/init.rb

Overview

Entity for API error responses

Class Method Summary collapse

Class Method Details

.call(message, backtrace, options, env) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/grape/cli/boilerplate/init.rb', line 20

def self.call(message, backtrace, options, env)
	if message.is_a? String
		{ status: 'error', error: message }.to_json
	elsif message.is_a? Hash
		status = { status: 'error' }
		(status.merge(message)).to_json
	end
end