exceptional 2.0.20 → 2.0.21
Sign up to get free protection for your applications and to get access to all the features.
@@ -57,17 +57,23 @@ module Exceptional
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def self.sanitize_hash(hash)
|
60
|
+
|
60
61
|
case hash
|
61
62
|
when Hash
|
62
|
-
hash.inject({}) do |result, (key, value)|
|
63
|
+
hash.inject({}) do |result, (key, value)|
|
63
64
|
result.update(key => sanitize_hash(value))
|
64
65
|
end
|
65
|
-
when
|
66
|
+
when Array
|
67
|
+
hash.collect{|value| sanitize_hash(value)}
|
68
|
+
when Fixnum, String, Bignum
|
66
69
|
hash
|
67
70
|
else
|
68
71
|
hash.to_s
|
69
72
|
end
|
70
|
-
rescue
|
73
|
+
rescue Exception => e
|
74
|
+
Exceptional.logger.error(hash)
|
75
|
+
Exceptional.logger.error(e.message)
|
76
|
+
Exceptional.logger.error(e.backtrace)
|
71
77
|
{}
|
72
78
|
end
|
73
79
|
|
data/lib/exceptional/version.rb
CHANGED
@@ -105,6 +105,17 @@ describe Exceptional::ControllerExceptionData, 'with request/controller/params'
|
|
105
105
|
input = {'crazy' => crazy, :simple => '123', :some_hash => {'1' => '2'}, :array => ['1', '2']}
|
106
106
|
Exceptional::ControllerExceptionData.sanitize_hash(input).should == {'crazy' => crazy.to_s, :simple => '123', :some_hash => {'1' => '2'}, :array => ['1', '2']}
|
107
107
|
end
|
108
|
+
|
109
|
+
it "allow if non jsonable objects are hidden in an array" do
|
110
|
+
class Bonkers
|
111
|
+
def to_json
|
112
|
+
no.can.do!
|
113
|
+
end
|
114
|
+
end
|
115
|
+
crazy = Bonkers.new
|
116
|
+
input = {'crazy' => [crazy]}
|
117
|
+
Exceptional::ControllerExceptionData.sanitize_hash(input).should == {'crazy' => [crazy.to_s]}
|
118
|
+
end
|
108
119
|
|
109
120
|
it "ArgumentError bug with file object" do
|
110
121
|
file = File.new(File.expand_path('../../fixtures/favicon.png',__FILE__))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exceptional
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 37
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 21
|
10
|
+
version: 2.0.21
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Contrast
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|