exception_handler 0.6.5 → 0.7.0
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.
- checksums.yaml +4 -4
- data/.gitignore +33 -33
- data/.rspec +3 -3
- data/.travis.yml +5 -5
- data/Gemfile +13 -13
- data/LICENSE.txt +22 -22
- data/README.md +349 -341
- data/Rakefile +7 -7
- data/app/assets/images/{favicon.ico → exception_handler.ico} +0 -0
- data/app/assets/images/exception_handler/alert.jpg +0 -0
- data/app/assets/images/exception_handler/bg.jpg +0 -0
- data/app/assets/images/exception_handler/favicon.ico +0 -0
- data/app/assets/images/exception_handler/icon.png +0 -0
- data/app/assets/stylesheets/exception_handler.css.erb +8 -8
- data/app/assets/stylesheets/styles/_base.css.erb +35 -34
- data/app/assets/stylesheets/styles/_exception.css.erb +105 -103
- data/app/assets/stylesheets/styles/_footer.css.erb +24 -27
- data/app/assets/stylesheets/styles/_responsive.css +5 -5
- data/app/controllers/exception_handler/exception_controller.rb +45 -38
- data/app/mailers/exception_handler/exception_mailer.rb +16 -16
- data/app/models/exception_handler/exception.rb +191 -191
- data/app/views/exception_handler/exception/show.html.erb +1 -1
- data/app/views/exception_handler/mailers/new_exception.erb +4 -4
- data/app/views/layouts/exception.html.erb +27 -21
- data/config/locales/exception_handler.en.yml +13 -13
- data/exception_handler.gemspec +80 -84
- data/lib/exception_handler.rb +32 -29
- data/lib/exception_handler/config.rb +80 -66
- data/lib/exception_handler/engine.rb +44 -36
- data/lib/generators/exception_handler/migration_generator.rb +55 -55
- data/lib/generators/exception_handler/views_generator.rb +42 -42
- data/lib/generators/templates/migration.rb.erb +16 -16
- data/spec/database.yml +2 -2
- data/spec/dummy/Rakefile +6 -6
- data/spec/dummy/app/assets/config/manifest.js +4 -4
- data/spec/dummy/app/assets/javascripts/application.js +13 -13
- data/spec/dummy/app/assets/javascripts/cable.coffee +11 -11
- data/spec/dummy/app/assets/stylesheets/application.css +15 -15
- data/spec/dummy/app/channels/application_cable/channel.rb +5 -5
- data/spec/dummy/app/channels/application_cable/connection.rb +5 -5
- data/spec/dummy/app/controllers/application_controller.rb +5 -5
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/jobs/application_job.rb +2 -2
- data/spec/dummy/app/mailers/application_mailer.rb +4 -4
- data/spec/dummy/app/models/application_record.rb +3 -3
- data/spec/dummy/app/views/layouts/application.html.erb +15 -15
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -1
- data/spec/dummy/bin/bundle +3 -3
- data/spec/dummy/bin/rails +4 -4
- data/spec/dummy/bin/rake +4 -4
- data/spec/dummy/bin/setup +34 -34
- data/spec/dummy/bin/update +29 -29
- data/spec/dummy/config.ru +8 -8
- data/spec/dummy/config/application.rb +21 -21
- data/spec/dummy/config/boot.rb +5 -5
- data/spec/dummy/config/cable.yml +10 -10
- data/spec/dummy/config/database.yml +25 -25
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +62 -62
- data/spec/dummy/config/environments/production.rb +87 -87
- data/spec/dummy/config/environments/test.rb +42 -42
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -6
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -6
- data/spec/dummy/config/initializers/assets.rb +11 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/callback_terminator.rb +6 -6
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/spec/dummy/config/initializers/inflections.rb +16 -16
- data/spec/dummy/config/initializers/mime_types.rb +4 -4
- data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -4
- data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -4
- data/spec/dummy/config/initializers/session_store.rb +3 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +23 -23
- data/spec/dummy/config/puma.rb +47 -47
- data/spec/dummy/config/routes.rb +6 -6
- data/spec/dummy/config/secrets.yml +22 -22
- data/spec/dummy/public/404.html +67 -67
- data/spec/dummy/public/422.html +67 -67
- data/spec/dummy/public/500.html +66 -66
- data/spec/exception_handler.rb +21 -21
- data/spec/exception_handler/exception_controller_spec.rb +18 -0
- data/spec/spec_helper.rb +54 -54
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2211c69b2d0f6f0f398db88612aae4a8967dbb83
|
4
|
+
data.tar.gz: 7d02292d53764231acdef24f5e286c099ae264d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 359b3813af909ae13cff91cdb3e83d8c88fa69f4e9f9f41aa95126b6a7f9e7becfa1676f930ffc1ae22d5ce51fa00fa92c8290201014dce0d2354d95e06f89ed
|
7
|
+
data.tar.gz: 78f0f47a6d9095fce23ac62ccd7ad82ca3baac8440b25829d207376cfd293a923b4fe408ce481472b5f0810c5c32b741a1d8b1199fbe62a705f80ef28fd2a47e
|
data/.gitignore
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
*.tmp
|
24
|
-
|
25
|
-
# http://stackoverflow.com/questions/8865848/comments-in-gitignore
|
26
|
-
# https://gist.github.com/danielpcox/4636520
|
27
|
-
|
28
|
-
log/*.log
|
29
|
-
pkg/
|
30
|
-
spec/dummy/db/*.sqlite3
|
31
|
-
spec/dummy/log/*.log
|
32
|
-
spec/dummy/tmp/
|
33
|
-
spec/dummy/.sass-cache
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
*.tmp
|
24
|
+
|
25
|
+
# http://stackoverflow.com/questions/8865848/comments-in-gitignore
|
26
|
+
# https://gist.github.com/danielpcox/4636520
|
27
|
+
|
28
|
+
log/*.log
|
29
|
+
pkg/
|
30
|
+
spec/dummy/db/*.sqlite3
|
31
|
+
spec/dummy/log/*.log
|
32
|
+
spec/dummy/tmp/
|
33
|
+
spec/dummy/.sass-cache
|
data/.rspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
--color
|
2
|
-
--format progress
|
3
|
-
--require spec_helper
|
1
|
+
--color
|
2
|
+
--format progress
|
3
|
+
--require spec_helper
|
4
4
|
--format documentation
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
rvm:
|
2
|
-
- 2.2.4
|
3
|
-
- 2.3.
|
4
|
-
- 2.4.0
|
5
|
-
- ruby-head
|
1
|
+
rvm:
|
2
|
+
- 2.2.4
|
3
|
+
- 2.3.2
|
4
|
+
- 2.4.0
|
5
|
+
- ruby-head
|
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in custom_error_pages.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
###########################################
|
7
|
-
|
8
|
-
#For Testing
|
9
|
-
group :test do
|
10
|
-
gem 'coveralls', require: false
|
11
|
-
end
|
12
|
-
|
13
|
-
###########################################
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in custom_error_pages.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
###########################################
|
7
|
+
|
8
|
+
#For Testing
|
9
|
+
group :test do
|
10
|
+
gem 'coveralls', require: false
|
11
|
+
end
|
12
|
+
|
13
|
+
###########################################
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2014 richpeck
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2014 richpeck
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,341 +1,349 @@
|
|
1
|
-

|
2
|
-
|
3
|
-
<p align="center">
|
4
|
-
<font size="4"><strong>Custom 404 & 500 production error pages for Rails 4 & 5.</font></strong>
|
5
|
-
</p>
|
6
|
-
|
7
|
-
<p align="center">
|
8
|
-
<a href="http://badge.fury.io/rb/exception_handler"><img src="https://badge.fury.io/rb/exception_handler.svg" align="absmiddle"></a>
|
9
|
-
<a href="http://rubygems.org/richpeck/exception_handler"><img src="http://ruby-gem-downloads-badge.herokuapp.com/exception_handler/0.5.1?type=total&color=brightgreen" align="absmiddle" /></a>
|
10
|
-
<a href="https://codeclimate.com/github/richpeck/exception_handler"><img src="https://codeclimate.com/github/richpeck/exception_handler/badges/gpa.svg" align="absmiddle"/></a>
|
11
|
-
<a href="https://gemnasium.com/richpeck/exception_handler"><img src="https://gemnasium.com/richpeck/exception_handler.svg" align="absmiddle"></a>
|
12
|
-
<a href='https://coveralls.io/github/richpeck/exception_handler?branch=master'><img src='https://coveralls.io/repos/github/richpeck/exception_handler/badge.svg?branch=master' alt='Coverage Status' align="absmiddle" /></a>
|
13
|
-
<a href="https://travis-ci.org/richpeck/exception_handler"><img src="https://travis-ci.org/richpeck/exception_handler.svg?branch=master" align="absmiddle"></a>
|
14
|
-
</p>
|
15
|
-
|
16
|
-
<p align="center">
|
17
|
-
<strong><a href="#user-content-install">Install</a></strong> → <strong><a href="#user-content-config">Setup</a></strong> → <strong><a href="#user-content-support">Support</a></strong>
|
18
|
-
</p>
|
19
|
-
|
20
|
-
---
|
21
|
-
|
22
|
-
<p align="center">
|
23
|
-
<img src="readme/version.
|
24
|
-
</p>
|
25
|
-
|
26
|
-
<p align="center">
|
27
|
-
<img src="readme/check.png" height="22" title="Fully Responsive" align="absmiddle" /> <strong>Responsive</strong>
|
28
|
-
<img src="readme/check.png" height="22" title="Branded Error Pages" align="absmiddle" /> <strong>Branded Error Pages</strong>
|
29
|
-
<img src="readme/check.png" height="22" title="Middleware Exception Handling" align="absmiddle" /> <strong>Middleware Exception Handling</strong>
|
30
|
-
<img src="readme/check.png" height="22" title="Keep Users Informed" align="absmiddle" /> <strong>Fully Customizable</strong>
|
31
|
-
</p>
|
32
|
-
|
33
|
-
<p align="center">
|
34
|
-
<img src="readme/branded/1.jpg" width="425" title="Fully Branded Error Pages" /> <img src="readme/branded/2.jpg" width="425" title="Fully Branded Error Pages" />
|
35
|
-
<img src="readme/branded/3.jpg" width="425" title="Fully Branded Error Pages" /> <img src="readme/branded/4.jpg" width="425" title="Fully Branded Error Pages" />
|
36
|
-
</p>
|
37
|
-
|
38
|
-
---
|
39
|
-
|
40
|
-
<p align="center">
|
41
|
-
<img src="readme/05.jpg" title="
|
42
|
-
</p>
|
43
|
-
|
44
|
-
<p align="center">
|
45
|
-
<img src="readme/titles/
|
46
|
-
</p>
|
47
|
-
|
48
|
-
<p align="center">
|
49
|
-
<img src="readme/check_02.png" height="22" title="New Controller" align="absmiddle" /> <strong>New Controller</strong>
|
50
|
-
<img src="readme/check_02.png" height="22" title="New Middleware" align="absmiddle" /> <strong>New Middleware</strong>
|
51
|
-
<img src="readme/check_02.png" height="22" title="Full Test Suite" align="absmiddle" /> <strong>Full Test Suite</strong>
|
52
|
-
<img src="readme/check_02.png" height="22" title="Rails 4 & 5 Compatible" align="absmiddle" /> <strong>
|
53
|
-
</p>
|
54
|
-
|
55
|
-
Brand new `controller
|
56
|
-
|
57
|
-
<
|
58
|
-
<
|
59
|
-
<img src="readme/
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
<br />
|
106
|
-
<
|
107
|
-
</p>
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
`
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
[
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
-
|
309
|
-
-
|
310
|
-
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
1
|
+

|
2
|
+
|
3
|
+
<p align="center">
|
4
|
+
<font size="4"><strong>Custom 404 & 500 production error pages for Rails 4 & 5.</font></strong>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p align="center">
|
8
|
+
<a href="http://badge.fury.io/rb/exception_handler"><img src="https://badge.fury.io/rb/exception_handler.svg" align="absmiddle"></a>
|
9
|
+
<a href="http://rubygems.org/richpeck/exception_handler"><img src="http://ruby-gem-downloads-badge.herokuapp.com/exception_handler/0.5.1?type=total&color=brightgreen" align="absmiddle" /></a>
|
10
|
+
<a href="https://codeclimate.com/github/richpeck/exception_handler"><img src="https://codeclimate.com/github/richpeck/exception_handler/badges/gpa.svg" align="absmiddle"/></a>
|
11
|
+
<a href="https://gemnasium.com/richpeck/exception_handler"><img src="https://gemnasium.com/richpeck/exception_handler.svg" align="absmiddle"></a>
|
12
|
+
<a href='https://coveralls.io/github/richpeck/exception_handler?branch=master'><img src='https://coveralls.io/repos/github/richpeck/exception_handler/badge.svg?branch=master' alt='Coverage Status' align="absmiddle" /></a>
|
13
|
+
<a href="https://travis-ci.org/richpeck/exception_handler"><img src="https://travis-ci.org/richpeck/exception_handler.svg?branch=master" align="absmiddle"></a>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p align="center">
|
17
|
+
<strong><a href="#user-content-install">Install</a></strong> → <strong><a href="#user-content-config">Setup</a></strong> → <strong><a href="#user-content-support">Support</a></strong>
|
18
|
+
</p>
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
<p align="center">
|
23
|
+
<img src="readme/version.jpg" /><br/>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p align="center">
|
27
|
+
<img src="readme/check.png" height="22" title="Fully Responsive" align="absmiddle" /> <strong>Responsive</strong>
|
28
|
+
<img src="readme/check.png" height="22" title="Branded Error Pages" align="absmiddle" /> <strong>Branded Error Pages</strong>
|
29
|
+
<img src="readme/check.png" height="22" title="Middleware Exception Handling" align="absmiddle" /> <strong>Middleware Exception Handling</strong>
|
30
|
+
<img src="readme/check.png" height="22" title="Keep Users Informed" align="absmiddle" /> <strong>Fully Customizable</strong>
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<p align="center">
|
34
|
+
<img src="readme/branded/1.jpg" width="425" title="Fully Branded Error Pages" /> <img src="readme/branded/2.jpg" width="425" title="Fully Branded Error Pages" />
|
35
|
+
<img src="readme/branded/3.jpg" width="425" title="Fully Branded Error Pages" /> <img src="readme/branded/4.jpg" width="425" title="Fully Branded Error Pages" />
|
36
|
+
</p>
|
37
|
+
|
38
|
+
---
|
39
|
+
|
40
|
+
<p align="center">
|
41
|
+
<img src="readme/05.jpg" title="Version 0.7.0" />
|
42
|
+
</p>
|
43
|
+
|
44
|
+
<p align="center">
|
45
|
+
<img src="readme/titles/rails5.png" title="Fully Rails 5 Compatible" width="550" />
|
46
|
+
</p>
|
47
|
+
|
48
|
+
<p align="center">
|
49
|
+
<img src="readme/check_02.png" height="22" title="New Controller" align="absmiddle" /> <strong align="absmiddle">New Controller</strong>
|
50
|
+
<img src="readme/check_02.png" height="22" title="New Middleware" align="absmiddle" /> <strong align="absmiddle">New Middleware</strong>
|
51
|
+
<img src="readme/check_02.png" height="22" title="Full Test Suite" align="absmiddle" /> <strong align="absmiddle">Full Test Suite</strong>
|
52
|
+
<img src="readme/check_02.png" height="22" title="Rails 4 & 5 Compatible" align="absmiddle" /> <strong align="absmiddle">Fully Rails 4 & 5 Compatible</strong>
|
53
|
+
</p>
|
54
|
+
|
55
|
+
Brand new `controller` & `middleware` have made **`ExceptionHandler`** even more powerful & efficient. Now you can use `ExceptionHandler` with a single click → **plug and play** custom exception pages:
|
56
|
+
|
57
|
+
<p align="center">
|
58
|
+
<br />
|
59
|
+
<img src="readme/404.png" title="400 Errors" width="430" />
|
60
|
+
<img src="readme/500.png" title="500 Errors" width="430" />
|
61
|
+
</p>
|
62
|
+
|
63
|
+
With major upgrades to the backend, **ExceptionHandler [0.7.0][latest]** is the leading exception management solution for Rails 5:
|
64
|
+
|
65
|
+
<p align="center">
|
66
|
+
<h3>Features</h3>
|
67
|
+
Custom 500 Errors Layout || DB || Model || Config || Email || 400 Default Layout || Sprockets 4 || Custom Exceptions
|
68
|
+
</p>
|
69
|
+
|
70
|
+
**ExceptionHandler works 100% with Rails 5 and Sprockets 4**. It hooks DIRECTLY into your existing CSS to create a professional exception interface with NO work on your part…
|
71
|
+
|
72
|
+
----
|
73
|
+
|
74
|
+
<p align="center">
|
75
|
+
<br />
|
76
|
+
<img src="readme/titles/middleware.png" title="Middleware-Powered Exceptions" width="400" />
|
77
|
+
</p>
|
78
|
+
|
79
|
+
The secret lies in [**`config.exceptions_app`**][exception_app] ↴
|
80
|
+
|
81
|
+
|
82
|
+
![config.exceptions_app - The key to all Rails exceptions][exceptions_app]
|
83
|
+
|
84
|
+
Because we handle **`requests`** directly (`message`, `details`, `user agent`), `ExceptionHandler` populates our custom `view` with any details required. This gives us the ability to **maintain your branding** (layout / css) even when exceptions are raised:
|
85
|
+
|
86
|
+
![Exceptions handled by the ActiveDispatch::ShowExceptions Middleware][middleware]
|
87
|
+
|
88
|
+
This is important at is means `ExceptionHandler` has absolutely ZERO bloat on an app. Rails is invoked ONCE (not twice like it is when using routes), delivering a response JUST LIKE if an exception wasn't raised.
|
89
|
+
|
90
|
+
<p align="center">
|
91
|
+
<strong>The <i>ONLY</i> professional solution to catch, process & handle Rails exceptions <i>WITHOUT</i> BLOAT:</strong>
|
92
|
+
</p>
|
93
|
+
|
94
|
+
<p align="center">
|
95
|
+
<img src="readme/controller_middleware.jpg" title="ExceptionsController compiles the exception & delivers to the front-end" />
|
96
|
+
</p>
|
97
|
+
|
98
|
+
The REAL beauty of ExceptionHandler is that you only have to serve **two** error responses → `400` & `500`. This is per the [HTTP spec](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4) - a browser CANNOT read any other form of error.
|
99
|
+
|
100
|
+
This means that we can use a single controller action to build our `@exception` object, responding to the HTTP request with the status code raised by the exception. We have built this into a simple & effective solution:
|
101
|
+
|
102
|
+
----------
|
103
|
+
|
104
|
+
<p align="center" id="install">
|
105
|
+
<br />
|
106
|
+
<img src="readme/titles/install.png" title="1 Click Install for ExceptionHandler 0.7.0 on Rails 5" width="400" />
|
107
|
+
</p>
|
108
|
+
|
109
|
+
[![Gemfile][gemfile]][rubygems] [![Gem][gem]][rubygems]
|
110
|
+
|
111
|
+
`ExceptionHandler`'s **config** system stores the - you just need to install the gem & let it run.
|
112
|
+
|
113
|
+
If you want to change *any* settings (detailed [below](#user-content-config)), you **simply** need to change `config/application.rb` or `config/environments/your_env.rb`. The ***POWER*** of this *new config system* means you're able to deploy `ExceptionHandler` in the most unobtrusive, versatile way possible:
|
114
|
+
|
115
|
+
----
|
116
|
+
|
117
|
+
**`ExceptionHandler 0.7.0`** has *drastically* improved our famous 1-click install.
|
118
|
+
|
119
|
+
Not only have we removed all the bloat, but our initialization process now relies on a *single* hook which will set all the config variables as required. This is stark difference to the myriad of poorly-designed gems which cause massive lag in your Rails initialization process. `ExceptionHandler` is now more streamlined than ever:
|
120
|
+
|
121
|
+
<p align="center">
|
122
|
+
<img src="readme/defaults.jpg" title="ExceptionHandler Default Config Options">
|
123
|
+
</p>
|
124
|
+
|
125
|
+
The **MAGIC** lies in the [`environment files`](http://guides.rubyonrails.org/configuring.html#creating-rails-environments).
|
126
|
+
|
127
|
+
Instead of dopey initializers (which slow the system down), you can just use the Rails config files to set environment-dependent options. This allows us to maximize performance without any of the overhead associated with old-fashioned gems.
|
128
|
+
|
129
|
+
> **IMPORTANT**
|
130
|
+
>
|
131
|
+
> If you're upgrading from >= `0.4.7`, you need to **remove your `exception_handler` initializer**.
|
132
|
+
>
|
133
|
+
> We've changed the load process to use Rails app config - **you don't need the `exception_handler` initializer any more**
|
134
|
+
|
135
|
+
----
|
136
|
+
|
137
|
+
<p id="defaults">
|
138
|
+
<img src="readme/titles/setup/defaults.jpg" title="Defaults" height="75" border="2" />
|
139
|
+
</p>
|
140
|
+
|
141
|
+
As can be seen in[`config`](/lib/exception_handler/config.rb), the following are all the options `ExceptionHandler` accepts:
|
142
|
+
|
143
|
+
<p align="center">
|
144
|
+
<img src="readme/defaults.jpg" title="ExceptionHandler Default Configuration Options">
|
145
|
+
</p>
|
146
|
+
|
147
|
+
# Defaults
|
148
|
+
DEFAULTS = {
|
149
|
+
dev: false, #-> defaults to "false" for dev mode
|
150
|
+
db: false, #-> defaults to :errors if true, else use "table_name" / :table_name
|
151
|
+
email: false, #-> requires string email and ActionMailer
|
152
|
+
social: {
|
153
|
+
facebook: { name: "frontline.utilities", url: "https://facebook.com" },
|
154
|
+
twitter: { name: "frontlineutils", url: "http://twitter.com" },
|
155
|
+
youtube: { name: "frontlineutils", url: "https://youtube.com/user" },
|
156
|
+
linkedin: { name: "frontline-utilities", url: "https://linkedin.com/company" },
|
157
|
+
fusion: { name: "flutils", url: "https://frontlinefusion.com" }
|
158
|
+
},
|
159
|
+
layouts: {
|
160
|
+
"400" => nil, # => inherits from "ApplicationController" layout
|
161
|
+
"500" => "exception"
|
162
|
+
},
|
163
|
+
}
|
164
|
+
|
165
|
+
You can apply any of the above defaults into one of the Rails [`environment files`](http://guides.rubyonrails.org/configuring.html#creating-rails-environments):
|
166
|
+
|
167
|
+
- `config/application.rb`
|
168
|
+
- `config/environments/development.rb`
|
169
|
+
- `config/environments/production.rb`
|
170
|
+
- `config/environments/staging.rb`
|
171
|
+
|
172
|
+
The benefit of this is that it gives you the ability to customize `ExceptionHandler` for *any* of your environments. Contrary to a shitty `initializer`, you're able to sculpt the gem to work for YOU.
|
173
|
+
|
174
|
+
----
|
175
|
+
|
176
|
+
![Development Mode][dev]
|
177
|
+
|
178
|
+
Want to test in the `dev` environment?
|
179
|
+
|
180
|
+
# config/application.rb
|
181
|
+
config.exception_handler = {
|
182
|
+
dev: true # -> Runs in development mode WITHOUT changing the app environment files
|
183
|
+
}
|
184
|
+
|
185
|
+
<img src="readme/dev.jpg" title="ExceptionHandler Dev Mode - NEW!!!!!">
|
186
|
+
|
187
|
+
[`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration) *only* works when you have [`config.consider_all_requests_local = true`](http://blog.bigbinary.com/2009/02/05/rescue_action_in_public-local_request-and-how-to-configure-local_request.html), which is `true` in `development`:
|
188
|
+
|
189
|
+
> **`config.consider_all_requests_local`** is a flag. If true then any error will cause detailed debugging information to be dumped in the `HTTP` response, and the `Rails::Info controller` will show the application runtime context in `/rails/info/properties`. `True` by default in development and test environments, and false in production mode. For finer-grained control, set this to false and implement `local_request?` in controllers to specify which requests should provide debugging information on errors.
|
190
|
+
|
191
|
+
|
192
|
+
If you wish to test **`ExceptionHandler`** in `development`, you'll have to use the `dev: true` option in your `exception_handler` config, *or* change `config.consider_all_requests_local = true` in `config/development.rb`.
|
193
|
+
|
194
|
+
----
|
195
|
+
|
196
|
+
<br />
|
197
|
+
<img src="readme/titles/layout.jpg" title="Layout" id="layout" />
|
198
|
+
|
199
|
+
One of the most critial aspects of **`ExceptionHandler`** is the custom `Exception` layout.
|
200
|
+
|
201
|
+
If you want to change the layout (for `500` error pages), you need to use the following:
|
202
|
+
|
203
|
+
<img src="readme/layout.jpg" title="Custom Exceptions Layout For ExceptionHandler" />
|
204
|
+
|
205
|
+
You'll need to [generate](#user-content-view) it into your application before being able to edit:
|
206
|
+
|
207
|
+
----
|
208
|
+
|
209
|
+
![View][view]
|
210
|
+
|
211
|
+
**`ExceptionHandler`** comes with its own inbuilt views & controller.
|
212
|
+
|
213
|
+
If you want to change it, you need to add the views into your app with the [`generator`](/lib/generators/exception_handler/views_generator.rb)
|
214
|
+
|
215
|
+
$ rails generate exception_handler:views #-> controller, models, helpers, views & assets
|
216
|
+
$ rails generate exception_handler:views -v views controllers models helpers assets #-> remove as appropriate to install individual assets
|
217
|
+
|
218
|
+
--
|
219
|
+
|
220
|
+
<img src="readme/show.jpg" title="ExceptionHandler Show view" />
|
221
|
+
|
222
|
+
`ExceptionHandler` uses `exceptions#show` -- located in **`app/views/exception_handler/show.html.erb`** designed to work for all exceptions.
|
223
|
+
|
224
|
+
By default, it is split for use with different layouts, data being available to both.
|
225
|
+
|
226
|
+
This works exactly the same as the other views in your app (IE the `exceptions controller` invokes the `show` action)
|
227
|
+
|
228
|
+
----
|
229
|
+
|
230
|
+
![Database][db]
|
231
|
+
|
232
|
+
If you want to store exceptions in your `db`, you will need to set up a **migration**:
|
233
|
+
|
234
|
+
$ rails generate exception_handler:migration
|
235
|
+
$ rake db:migrate
|
236
|
+
|
237
|
+
You will also need to ensure your config db option is either `true` or `"table_name"`:
|
238
|
+
|
239
|
+
<img src="readme/db.jpg" title="ExceptionHandler DB Config">
|
240
|
+
|
241
|
+
<img src="readme/db_screenshot.jpg" title="ExceptionHandler Database">
|
242
|
+
|
243
|
+
> **IMPORTANT**
|
244
|
+
>
|
245
|
+
> `ExceptionHandler`'s [new config system](https://github.com/richpeck/exception_handler/wiki/Setup) is `environment` agnostic.
|
246
|
+
>
|
247
|
+
> **Where you declare your `db` setting will change depending on your environment**
|
248
|
+
>
|
249
|
+
> If you declare `db` in `application.rb`, it will be applicable for all `environments`; only declaring in `production.rb` will set it for production *only*.
|
250
|
+
|
251
|
+
----
|
252
|
+
|
253
|
+
### ![Support][support]
|
254
|
+
|
255
|
+
We offer support through [GitHub](http://github.com/richpeck/exception_handler/issues) and [StackOverflow](http://stackoverflow.com/questions/ask?tags=ruby-on-rails+exception-handler).
|
256
|
+
|
257
|
+
Whilst we can't guarantee response times, we are always eager to make sure `ExceptionHandler` is the most secure, robust and effective solution for Rails exception pages. You can use the links below to access support directly:
|
258
|
+
|
259
|
+
Github (~1hr) | Stackoverflow (~24hrs)
|
260
|
+
:----: | :----:
|
261
|
+
[](https://github.com/richpeck/exception_handler/issues) | [](http://stackoverflow.com/questions/ask?tags=ruby-on-rails+exception-handler)
|
262
|
+
|
263
|
+
We use **`ExceptionHandler`** in production, so have a vested interest in keeping it running smoothly.
|
264
|
+
|
265
|
+
---
|
266
|
+
|
267
|
+
# ![Changelog - Current Version 0.7.0][changelog]
|
268
|
+
|
269
|
+
Current version is [**`0.7.0`**](https://github.com/richpeck/exception_handler/releases/latest)
|
270
|
+
|
271
|
+
Functionality remains consistent with previous releases, main difference will be the way in which they handle backend processes. **`0.7.0`** completely overhauled the backend, making the `controller`, `model` and `middleware` much more streamlined.
|
272
|
+
|
273
|
+
The biggest update for **`0.7.0.`** has been the removal of most middleware, putting the entire system into a central class. This not only allows us to centralize the data structure, but also remove many files which didn't matter.
|
274
|
+
|
275
|
+
Here is a rundown of what's been implemented ↴
|
276
|
+
|
277
|
+
### [→ 0.7.0](https://github.com/richpeck/exception_handler/releases/tag/0.7.0)
|
278
|
+
- [ ] Wildcard mime types
|
279
|
+
- [ ] Custom exceptions
|
280
|
+
- [x] Test suite integration
|
281
|
+
- [ ] Exception "mapping" (choose which exceptions to handle)
|
282
|
+
- [x] [Email](https://github.com/richpeck/exception_handler/wiki/2-Email)
|
283
|
+
- [x] Model backend
|
284
|
+
- [x] Sprockets 4+
|
285
|
+
- [x] Readme / wiki overhaul
|
286
|
+
|
287
|
+
### [→ 0.6.5](https://github.com/richpeck/exception_handler/releases/tag/0.6.5)
|
288
|
+
- [x] Streamlined interface
|
289
|
+
- [x] ActiveRecord / Middleware overhaul
|
290
|
+
- [x] Supports Sprockets 4+ ([`manifest.js`](http://eileencodes.com/posts/the-sprockets-4-manifest/))
|
291
|
+
- [x] Email integration
|
292
|
+
- [x] Asset overhaul & improvement
|
293
|
+
- [x] Removed dependencies
|
294
|
+
|
295
|
+
### [→ 0.5.0](https://github.com/richpeck/exception_handler/releases/tag/0.5.0)
|
296
|
+
- [x] Added locales
|
297
|
+
- [x] Email notifications
|
298
|
+
- [x] Full test suite
|
299
|
+
- [x] Rails 4.2 & Rails 5.0 native ([`request.env`](https://github.com/rails/rails/commit/05934d24aff62d66fc62621aa38dae6456e276be) fix)
|
300
|
+
- [x] Controller fixed
|
301
|
+
- [x] `DB` fixed
|
302
|
+
- [x] Legacy initializer support ([more](https://github.com/richpeck/exception_handler/wiki/1-Setup))
|
303
|
+
- [x] Rails asset management improvement
|
304
|
+
- [x] Reduced gem file
|
305
|
+
|
306
|
+
### [→ 0.4.6](https://github.com/richpeck/exception_handler/releases/tag/0.4.6)
|
307
|
+
- [x] New config system ([more](https://github.com/richpeck/exception_handler/wiki/1-Setup))
|
308
|
+
- [x] Fixed controller layout issues
|
309
|
+
- [x] Streamlined middleware
|
310
|
+
- [x] New layout & interface implementation
|
311
|
+
|
312
|
+
----------
|
313
|
+
|
314
|
+
:copyright: <a href="http://www.frontlineutilities.co.uk" align="absmiddle" ><img src="readme/fl.jpg" height="22" align="absmiddle" /></a> <a href="http://stackoverflow.com/users/1143732/richard-peck?tab=profile" align="absmiddle" ><img src="https://avatars0.githubusercontent.com/u/1104431" height="22" align="absmiddle" /></a>
|
315
|
+
|
316
|
+
<!-- ################################### -->
|
317
|
+
<!-- ################################### -->
|
318
|
+
|
319
|
+
<!-- Refs -->
|
320
|
+
<!-- Comments http://stackoverflow.com/a/20885980/1143732 -->
|
321
|
+
<!-- Images https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#images -->
|
322
|
+
|
323
|
+
<!-- Images -->
|
324
|
+
[config.exceptions_app]: readme/config.exceptions_app.jpg
|
325
|
+
[gem]: readme/gem.jpg
|
326
|
+
[gemfile]: readme/gemfile.jpg
|
327
|
+
[middleware]: readme/middleware.jpg
|
328
|
+
[exceptions_app]: readme/exceptions_app.jpg
|
329
|
+
[view]: readme/titles/view.jpg
|
330
|
+
[dev]: readme/titles/dev.jpg
|
331
|
+
[db]: readme/titles/db.png
|
332
|
+
[support]: readme/titles/support.png "Support"
|
333
|
+
[changelog]: readme/titles/changelog.png "Changelog"
|
334
|
+
[contribution]: readme/titles/contributions.png "Contributions"
|
335
|
+
[fl]: readme/fl.jpg "Frontline Utilities LTD"
|
336
|
+
[profile]: https://avatars0.githubusercontent.com/u/1104431 "R Peck"
|
337
|
+
|
338
|
+
<!-- Links -->
|
339
|
+
[latest]: https://github.com/richpeck/exception_handler/releases/latest
|
340
|
+
[show_exception]: https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
|
341
|
+
[exception_app]: http://guides.rubyonrails.org/configuring.html#rails-general-configuration
|
342
|
+
[rubygems]: http://rubygems.org/gems/exception_handler
|
343
|
+
[frontlineutilities.co.uk]: http://www.frontlineutilities.co.uk
|
344
|
+
[stackoverflow.com]: http://stackoverflow.com/users/1143732/richard-peck?tab=profile
|
345
|
+
[fork]: #fork-destination-box
|
346
|
+
[pull]: http://github.com/richpeck/exception_handler/pulls
|
347
|
+
|
348
|
+
<!-- ################################### -->
|
349
|
+
<!-- ################################### -->
|