rails_exception_handler 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +31 -31
- data/HISTORY +5 -2
- data/README.markdown +17 -6
- data/VERSION +1 -1
- data/lib/rails_exception_handler/configuration.rb +12 -0
- data/lib/rails_exception_handler/parser.rb +1 -1
- data/lib/rails_exception_handler/storage.rb +1 -0
- data/rails_exception_handler.gemspec +5 -5
- metadata +4 -4
data/Gemfile
CHANGED
@@ -2,11 +2,11 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
group :test, :development do
|
4
4
|
|
5
|
-
#gem "rails", '3.0.
|
5
|
+
#gem "rails", '3.0.13'
|
6
6
|
#gem "rack-test", '0.5.7'
|
7
7
|
#gem "mysql2", '0.2.6'
|
8
8
|
|
9
|
-
gem "rails", '3.2.
|
9
|
+
gem "rails", '3.2.5'
|
10
10
|
gem "rack-test", '0.6.1'
|
11
11
|
gem 'mysql2', '0.3.11'
|
12
12
|
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_exception_handler (2.0.
|
4
|
+
rails_exception_handler (2.0.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionmailer (3.2.
|
10
|
-
actionpack (= 3.2.
|
9
|
+
actionmailer (3.2.5)
|
10
|
+
actionpack (= 3.2.5)
|
11
11
|
mail (~> 2.4.4)
|
12
|
-
actionpack (3.2.
|
13
|
-
activemodel (= 3.2.
|
14
|
-
activesupport (= 3.2.
|
12
|
+
actionpack (3.2.5)
|
13
|
+
activemodel (= 3.2.5)
|
14
|
+
activesupport (= 3.2.5)
|
15
15
|
builder (~> 3.0.0)
|
16
16
|
erubis (~> 2.7.0)
|
17
17
|
journey (~> 1.0.1)
|
18
18
|
rack (~> 1.4.0)
|
19
19
|
rack-cache (~> 1.2)
|
20
20
|
rack-test (~> 0.6.1)
|
21
|
-
sprockets (~> 2.1.
|
22
|
-
activemodel (3.2.
|
23
|
-
activesupport (= 3.2.
|
21
|
+
sprockets (~> 2.1.3)
|
22
|
+
activemodel (3.2.5)
|
23
|
+
activesupport (= 3.2.5)
|
24
24
|
builder (~> 3.0.0)
|
25
|
-
activerecord (3.2.
|
26
|
-
activemodel (= 3.2.
|
27
|
-
activesupport (= 3.2.
|
25
|
+
activerecord (3.2.5)
|
26
|
+
activemodel (= 3.2.5)
|
27
|
+
activesupport (= 3.2.5)
|
28
28
|
arel (~> 3.0.2)
|
29
29
|
tzinfo (~> 0.3.29)
|
30
|
-
activeresource (3.2.
|
31
|
-
activemodel (= 3.2.
|
32
|
-
activesupport (= 3.2.
|
33
|
-
activesupport (3.2.
|
30
|
+
activeresource (3.2.5)
|
31
|
+
activemodel (= 3.2.5)
|
32
|
+
activesupport (= 3.2.5)
|
33
|
+
activesupport (3.2.5)
|
34
34
|
i18n (~> 0.6)
|
35
35
|
multi_json (~> 1.0)
|
36
36
|
arel (3.0.2)
|
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
treetop (~> 1.4.8)
|
55
55
|
method_source (0.7.1)
|
56
56
|
mime-types (1.18)
|
57
|
-
multi_json (1.3.
|
57
|
+
multi_json (1.3.6)
|
58
58
|
mysql2 (0.3.11)
|
59
59
|
polyglot (0.3.3)
|
60
60
|
pry (0.9.9.6)
|
@@ -68,21 +68,21 @@ GEM
|
|
68
68
|
rack
|
69
69
|
rack-test (0.6.1)
|
70
70
|
rack (>= 1.0)
|
71
|
-
rails (3.2.
|
72
|
-
actionmailer (= 3.2.
|
73
|
-
actionpack (= 3.2.
|
74
|
-
activerecord (= 3.2.
|
75
|
-
activeresource (= 3.2.
|
76
|
-
activesupport (= 3.2.
|
71
|
+
rails (3.2.5)
|
72
|
+
actionmailer (= 3.2.5)
|
73
|
+
actionpack (= 3.2.5)
|
74
|
+
activerecord (= 3.2.5)
|
75
|
+
activeresource (= 3.2.5)
|
76
|
+
activesupport (= 3.2.5)
|
77
77
|
bundler (~> 1.0)
|
78
|
-
railties (= 3.2.
|
79
|
-
railties (3.2.
|
80
|
-
actionpack (= 3.2.
|
81
|
-
activesupport (= 3.2.
|
78
|
+
railties (= 3.2.5)
|
79
|
+
railties (3.2.5)
|
80
|
+
actionpack (= 3.2.5)
|
81
|
+
activesupport (= 3.2.5)
|
82
82
|
rack-ssl (~> 1.3.2)
|
83
83
|
rake (>= 0.8.7)
|
84
84
|
rdoc (~> 3.4)
|
85
|
-
thor (
|
85
|
+
thor (>= 0.14.6, < 2.0)
|
86
86
|
rake (0.9.2.2)
|
87
87
|
rdoc (3.12)
|
88
88
|
json (~> 1.4)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
rspec-core (~> 2.10.0)
|
91
91
|
rspec-expectations (~> 2.10.0)
|
92
92
|
rspec-mocks (~> 2.10.0)
|
93
|
-
rspec-core (2.10.
|
93
|
+
rspec-core (2.10.1)
|
94
94
|
rspec-expectations (2.10.0)
|
95
95
|
diff-lcs (~> 1.1.3)
|
96
96
|
rspec-mocks (2.10.1)
|
@@ -104,7 +104,7 @@ GEM
|
|
104
104
|
hike (~> 1.2)
|
105
105
|
rack (~> 1.0)
|
106
106
|
tilt (~> 1.1, != 1.3.0)
|
107
|
-
thor (0.
|
107
|
+
thor (0.15.2)
|
108
108
|
tilt (1.3.3)
|
109
109
|
treetop (1.4.10)
|
110
110
|
polyglot
|
@@ -119,6 +119,6 @@ DEPENDENCIES
|
|
119
119
|
mysql2 (= 0.3.11)
|
120
120
|
pry
|
121
121
|
rack-test (= 0.6.1)
|
122
|
-
rails (= 3.2.
|
122
|
+
rails (= 3.2.5)
|
123
123
|
rails_exception_handler!
|
124
124
|
rspec-rails
|
data/HISTORY
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
|
3
|
-
v2.0.
|
3
|
+
v2.0.2 - June 11th 2012
|
4
|
+
- Add attribute whitelisting mechanism for the active_record storage
|
5
|
+
|
6
|
+
v2.0.1 - May 27th 2012
|
4
7
|
- Fix ruby187 issue and a typo in the generator
|
5
8
|
|
6
|
-
v2.0.0 - May
|
9
|
+
v2.0.0 - May 14th 2012
|
7
10
|
- New API for specifying what information to store about the request, exception and environment
|
8
11
|
- Added a generator that creates an initializer
|
9
12
|
|
data/README.markdown
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Rails Exception Handler [![Build Status](http://travis-ci.org/Sharagoz/
|
1
|
+
# Rails Exception Handler [![Build Status](http://travis-ci.org/Sharagoz/rails_exception_handler.png)](http://travis-ci.org/#!/Sharagoz/rails_exception_handler)
|
2
2
|
|
3
3
|
Upgrading from version 1? [See wiki](https://github.com/Sharagoz/rails_exception_handler/wiki/Version-2.0-upgrade-instructions)
|
4
4
|
|
5
|
-
This is a flexible exception handler for Rails 3 built as Rack middleware. It is aimed at experienced Rails developers who are administrating more than just a couple of rails applications. Dont be intimidated if you're new to
|
5
|
+
This is a flexible exception handler for Rails 3 built as Rack middleware. It is aimed at experienced Rails developers who are administrating more than just a couple of rails applications. Dont be intimidated if you're new to Rails though, it's not that hard to set up.
|
6
6
|
|
7
|
-
The exception handler enables you to save the key information from the error message in a database somewhere and display a customized error message to the user within the applications layout file. You can hook this exception handler into all your rails apps and gather the exception reports in one place. The exception handler just contains the back end, you will have to create your own front end to view and manage the error reports.
|
7
|
+
The exception handler enables you to save the key information from the error message in a database somewhere, via ActiveRecord or HTTP POST, and display a customized error message to the user within the applications layout file. You can hook this exception handler into all your rails apps and gather the exception reports in one place. The exception handler just contains the back end, you will have to create your own front end to view and manage the error reports.
|
8
8
|
|
9
9
|
Does your app have an authorization mechanism? [See wiki](https://github.com/Sharagoz/rails_exception_handler/wiki/Interaction-with-authorization-mechanisms)
|
10
10
|
|
@@ -57,6 +57,12 @@ The exception handler will always use the layout file of the controller action t
|
|
57
57
|
|
58
58
|
This is a callback that exists in case you need to do something right after the initializer has been run, for instance [interact with an authorization mechanism](https://github.com/Sharagoz/rails_exception_handler/wiki/Interaction-with-authorization-mechanisms)
|
59
59
|
|
60
|
+
```ruby
|
61
|
+
config.after_initialize do
|
62
|
+
# additional setup
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
60
66
|
### responses and response_mapping
|
61
67
|
|
62
68
|
Note: public/500.html and public/400.html will be used if these exists. Remove these files before applying the configuration below.
|
@@ -83,19 +89,22 @@ config.response_mapping = {
|
|
83
89
|
|
84
90
|
Gathering and storing exception information is optional, but still the main purpose of this exception handler.
|
85
91
|
|
86
|
-
The following
|
92
|
+
The following four methods exists for extracting the information you need. You are given direct access to the relevant objects, which means full flexibility, but also more work on your part.
|
87
93
|
The initializers contains a basic suggestion, you can check out [the wiki](https://github.com/Sharagoz/rails_exception_handler/wiki/Extracting-exception-info)
|
88
94
|
for more options, or inspect the objects yourself with a tool like Pry to find what you need.
|
89
95
|
|
90
|
-
The "storage" hash below is the object that is sent to the storage strategy. Make sure the keys in the hash matches up with the
|
96
|
+
The "storage" hash below is the object that is sent to the storage strategy. Make sure the keys in the hash matches up with the names of the database fields.
|
91
97
|
|
92
98
|
```ruby
|
93
99
|
config.store_request_info do |storage,request|
|
94
100
|
end
|
95
|
-
|
101
|
+
|
102
|
+
config.store_exception_info do |storage,exception|
|
96
103
|
end
|
104
|
+
|
97
105
|
config.store_environment_info do |storage,env|
|
98
106
|
end
|
107
|
+
|
99
108
|
config.store_global_info do |storage|
|
100
109
|
end
|
101
110
|
```
|
@@ -218,6 +227,8 @@ config.filters = [:anon_404s]
|
|
218
227
|
|
219
228
|
When turned on the following exceptions will no longer be stored unless a user is logged in: ActionController::RoutingError, AbstractController::ActionNotFound, ActiveRecord::RecordNotFound
|
220
229
|
|
230
|
+
Note: This filter depends on config.store_user_info to figure out how to get access to the current_user object. This will be cleaned up in a future release.
|
231
|
+
|
221
232
|
### :no_referer_404s
|
222
233
|
|
223
234
|
```ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2
|
@@ -9,6 +9,7 @@ class RailsExceptionHandler::Configuration
|
|
9
9
|
@fallback_layout = 'application'
|
10
10
|
@response_mapping = {}
|
11
11
|
@responses = {}
|
12
|
+
@whitelisted = false
|
12
13
|
end
|
13
14
|
|
14
15
|
def active_record?
|
@@ -43,4 +44,15 @@ class RailsExceptionHandler::Configuration
|
|
43
44
|
@request_info_block = block
|
44
45
|
end
|
45
46
|
|
47
|
+
def whitelist(fields)
|
48
|
+
return if(whitelisted?)
|
49
|
+
ErrorMessage.send(:attr_accessible, *fields)
|
50
|
+
@whitelisted = true
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def whitelisted?
|
56
|
+
@whitelisted
|
57
|
+
end
|
46
58
|
end
|
@@ -22,7 +22,7 @@ class RailsExceptionHandler::Parser
|
|
22
22
|
config.exception_info_block.call(@external_info, @exception) if(config.exception_info_block)
|
23
23
|
config.env_info_block.call(@external_info, @env) if(config.env_info_block)
|
24
24
|
config.global_info_block.call(@external_info) if(config.global_info_block)
|
25
|
-
@external_info[:user_info] = user_info
|
25
|
+
@external_info[:user_info] = user_info if(user_info)
|
26
26
|
end
|
27
27
|
|
28
28
|
def ignore?
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rails_exception_handler"
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sharagoz"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-06-11"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "contact@sharagoz.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
s.specification_version = 3
|
60
60
|
|
61
61
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
|
-
s.add_development_dependency(%q<rails>, ["= 3.2.
|
62
|
+
s.add_development_dependency(%q<rails>, ["= 3.2.5"])
|
63
63
|
s.add_development_dependency(%q<rack-test>, ["= 0.6.1"])
|
64
64
|
s.add_development_dependency(%q<mysql2>, ["= 0.3.11"])
|
65
65
|
s.add_development_dependency(%q<pry>, [">= 0"])
|
@@ -67,7 +67,7 @@ Gem::Specification.new do |s|
|
|
67
67
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
68
68
|
s.add_development_dependency(%q<rails_exception_handler>, [">= 0"])
|
69
69
|
else
|
70
|
-
s.add_dependency(%q<rails>, ["= 3.2.
|
70
|
+
s.add_dependency(%q<rails>, ["= 3.2.5"])
|
71
71
|
s.add_dependency(%q<rack-test>, ["= 0.6.1"])
|
72
72
|
s.add_dependency(%q<mysql2>, ["= 0.3.11"])
|
73
73
|
s.add_dependency(%q<pry>, [">= 0"])
|
@@ -76,7 +76,7 @@ Gem::Specification.new do |s|
|
|
76
76
|
s.add_dependency(%q<rails_exception_handler>, [">= 0"])
|
77
77
|
end
|
78
78
|
else
|
79
|
-
s.add_dependency(%q<rails>, ["= 3.2.
|
79
|
+
s.add_dependency(%q<rails>, ["= 3.2.5"])
|
80
80
|
s.add_dependency(%q<rack-test>, ["= 0.6.1"])
|
81
81
|
s.add_dependency(%q<mysql2>, ["= 0.3.11"])
|
82
82
|
s.add_dependency(%q<pry>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_exception_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.5
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rack-test
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|