20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/appygram-rails/catcher.rb', line 20
def handle_with_controller(exception, controller=nil, request=nil)
params = {}
if controller and controller.respond_to?(:current_user)
cu = controller.current_user
if cu
if cu.respond_to?(:email) and cu.email
params['email'] = cu.email
end
if cu.respond_to?(:name) and cu.name
params['name'] = cu.name
end
end
end
if request
o = {
'url' => (request.respond_to?(:url) ? request.url : "#{request.protocol}#{request.host}#{request.request_uri}"),
'controller' => controller.class.to_s,
'action' => (request.respond_to?(:parameters) ? request.parameters['action'] : request.params['action']),
'parameters' => (request.respond_to?(:parameters) ? request.parameters : request.params),
'request_method' => request.request_method.to_s,
'remote_ip' => (request.respond_to?(:remote_ip) ? request.remote_ip : request.ip),
'headers' => (request.env)
}
params['app_json'] = JSON o
end
Appygram.trace(exception, params)
end
|