module Kraftwerk::Endpoint::Callable
Replacement for Hanami::Action::Callable, which does not care about return value of the call method, instead requiring us to assign response via self.body= or via view. We don't want that in Kraftwerk
. Return value from call
should be interpreted and returned by the framework.
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
# File lib/kraftwerk/endpoint/callable.rb, line 7 def call(env) params = Hanami::Action::BaseParams.new(env) begin response = super(params) rescue StandardError => e puts e puts e.backtrace.join("\n") response = Kraftwerk::Response.new(code: 500, body: { error: 'Internal server error' }) end ResponseFormatter.new.call(response: response, params: params) end