flail 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/flail/exception.rb +29 -3
- data/lib/flail/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/flail/exception.rb
CHANGED
@@ -30,6 +30,27 @@ class Flail
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def clean_unserializable_data(data, stack = [])
|
34
|
+
return "[possible infinite recursion halted]" if stack.any? {|item| item == data.object_id}
|
35
|
+
|
36
|
+
if data.respond_to?(:to_hash)
|
37
|
+
data.to_hash.inject({}) do |result, (key, value)|
|
38
|
+
result.merge(key => clean_unserializable_data(value, stack + [data.object_id]))
|
39
|
+
end
|
40
|
+
elsif data.respond_to?(:to_ary)
|
41
|
+
data.to_ary.collect do |value|
|
42
|
+
clean_unserializable_data(value, stack + [data.object_id])
|
43
|
+
end
|
44
|
+
else
|
45
|
+
data.to_s
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def clean_rack_env(data)
|
50
|
+
data.delete("rack.request.form_vars")
|
51
|
+
data
|
52
|
+
end
|
53
|
+
|
33
54
|
|
34
55
|
#
|
35
56
|
# Handling the exception
|
@@ -43,16 +64,21 @@ class Flail
|
|
43
64
|
info = {}
|
44
65
|
|
45
66
|
# rack env
|
46
|
-
info[:rack] = @env
|
67
|
+
info[:rack] = clean_rack_env(clean_unserializable_data(@env))
|
68
|
+
|
47
69
|
info[:class_name] = @exception.class.to_s # @exception class
|
48
70
|
info[:message] = @exception.to_s # error message
|
49
71
|
info[:trace] = @exception.backtrace # backtrace of error
|
50
72
|
info[:target_url] = request_data[:target_url] # url of request
|
51
73
|
info[:referer_url] = request_data[:referer_url] # referer
|
52
|
-
info[:parameters] = request_data[:parameters] # request parameters
|
53
74
|
info[:user_agent] = request_data[:user_agent] # user agent
|
54
75
|
info[:user] = request_data[:user] # current user
|
55
|
-
|
76
|
+
|
77
|
+
# request parameters
|
78
|
+
info[:parameters] = clean_unserializable_data(request_data[:parameters])
|
79
|
+
|
80
|
+
# session
|
81
|
+
info[:session_data]= clean_unserializable_data(request_data[:session_data])
|
56
82
|
|
57
83
|
# special variables
|
58
84
|
info[:environment] = Flail.configuration.env
|
data/lib/flail/version.rb
CHANGED