module BOILERPLATE::ErrorFormatter

Entity for API error responses

Public Class Methods

call(message, backtrace, options, env) click to toggle source
# 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