exception_handler 0.4.7 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -1
  4. data/Gemfile +1 -1
  5. data/README.md +241 -92
  6. data/app/controllers/exception_handler/exception_controller.rb +13 -44
  7. data/app/helpers/exception_handler/application_helper.rb +47 -23
  8. data/app/models/exception_handler/error.rb +10 -9
  9. data/app/services/exception_handler/exception.rb +34 -0
  10. data/app/views/exception_handler/exception/show.html.erb +9 -6
  11. data/app/views/layouts/exception.html.erb +3 -3
  12. data/config/locales/en.yml +9 -0
  13. data/exception_handler.gemspec +16 -6
  14. data/lib/exception_handler.rb +67 -32
  15. data/lib/exception_handler/config.rb +49 -46
  16. data/lib/exception_handler/parse.rb +17 -17
  17. data/lib/exception_handler/parser/data.rb +57 -51
  18. data/lib/exception_handler/parser/ignore.rb +23 -23
  19. data/lib/exception_handler/version.rb +1 -1
  20. data/lib/generators/exception_handler/migration_generator.rb +17 -17
  21. data/lib/generators/exception_handler/views_generator.rb +27 -27
  22. data/spec/database.yml +3 -0
  23. data/spec/dummy/Rakefile +6 -0
  24. data/spec/dummy/app/assets/config/manifest.js +4 -0
  25. data/spec/dummy/app/assets/images/.keep +0 -0
  26. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  27. data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
  28. data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
  29. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  30. data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
  31. data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  33. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/jobs/application_job.rb +2 -0
  36. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  37. data/spec/dummy/app/models/application_record.rb +3 -0
  38. data/spec/dummy/app/models/concerns/.keep +0 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  40. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  41. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  42. data/spec/dummy/bin/bundle +3 -0
  43. data/spec/dummy/bin/rails +4 -0
  44. data/spec/dummy/bin/rake +4 -0
  45. data/spec/dummy/bin/setup +34 -0
  46. data/spec/dummy/bin/update +29 -0
  47. data/spec/dummy/config.ru +8 -0
  48. data/spec/dummy/config/application.rb +21 -0
  49. data/spec/dummy/config/boot.rb +5 -0
  50. data/spec/dummy/config/cable.yml +10 -0
  51. data/spec/dummy/config/database.yml +25 -0
  52. data/spec/dummy/config/environment.rb +5 -0
  53. data/spec/dummy/config/environments/development.rb +62 -0
  54. data/spec/dummy/config/environments/production.rb +87 -0
  55. data/spec/dummy/config/environments/test.rb +42 -0
  56. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  57. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  58. data/spec/dummy/config/initializers/assets.rb +11 -0
  59. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
  61. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  62. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  63. data/spec/dummy/config/initializers/inflections.rb +16 -0
  64. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  65. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
  66. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
  67. data/spec/dummy/config/initializers/session_store.rb +3 -0
  68. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  69. data/spec/dummy/config/locales/en.yml +23 -0
  70. data/spec/dummy/config/puma.rb +47 -0
  71. data/spec/dummy/config/routes.rb +6 -0
  72. data/spec/dummy/config/secrets.yml +22 -0
  73. data/spec/dummy/lib/assets/.keep +0 -0
  74. data/spec/dummy/log/.keep +0 -0
  75. data/spec/dummy/public/404.html +67 -0
  76. data/spec/dummy/public/422.html +67 -0
  77. data/spec/dummy/public/500.html +66 -0
  78. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  79. data/spec/dummy/public/apple-touch-icon.png +0 -0
  80. data/spec/dummy/public/favicon.ico +0 -0
  81. data/spec/exception_handler.rb +22 -0
  82. data/spec/helpers/exception_handler/application_helper_spec.rb +42 -0
  83. data/spec/spec_helper.rb +28 -9
  84. metadata +102 -39
  85. data/readme/400.jpg +0 -0
  86. data/readme/500.jpg +0 -0
  87. data/readme/application_controller.jpg +0 -0
  88. data/readme/config.jpg +0 -0
  89. data/readme/db.jpg +0 -0
  90. data/readme/db_edit.jpg +0 -0
  91. data/readme/dev.jpg +0 -0
  92. data/readme/exception_controller.jpg +0 -0
  93. data/readme/exceptions_app.png +0 -0
  94. data/readme/layout.jpg +0 -0
  95. data/readme/parser.jpg +0 -0
  96. data/readme/rubygems.jpg +0 -0
  97. data/readme/source/screen.psd +0 -0
  98. data/readme/source/subtitle.psd +0 -0
  99. data/readme/source/title.psd +0 -0
  100. data/readme/subtitle.jpg +0 -0
  101. data/readme/title.jpg +0 -0
  102. data/readme/titles/bugs.png +0 -0
  103. data/readme/titles/contents.png +0 -0
  104. data/readme/titles/contribution.png +0 -0
  105. data/readme/titles/custom_error_pages.png +0 -0
  106. data/readme/titles/support.png +0 -0
  107. data/readme/titles/testing.png +0 -0
  108. data/readme/titles/title.psd +0 -0
  109. data/readme/view.jpg +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11013db45b531b62683007e0106bd99cbd127e87
4
- data.tar.gz: 7ff985c6b94846376adf94e66d52bb9778683969
3
+ metadata.gz: 8c229b37921ac22e8324f72d64e9e3b5278057f3
4
+ data.tar.gz: 5e858de7ce25556d18bb5abba14864193e0d1d7b
5
5
  SHA512:
6
- metadata.gz: bbe185c0ef99ad271803055c4469fc118251413d9918b80778479ec11b84f7acfa8e0ec5e679bda9e521fb83d6f096240d751e4db81482052376ee98d6d9bd73
7
- data.tar.gz: 2a585fe7364b3962341450dda80b6086942d46718cbb15ba12311606c6c9b88930bc581d9dd6cbf30819a118941c5f4be021feb132ee3c304b9f7b3ec0292a19
6
+ metadata.gz: af0923ee9aff4299876616cbd7dfda47669b91e77073e80182bc617c86949332229ac152d98ee7604a63f8827df19db216c5851ac8b346a8a280bdb26cd27a4a
7
+ data.tar.gz: 6df51af9f68cfaece304c42327487119fe1e4c966e1e7867e2c95c623e1dcf4e2945c627d316b01ec5f679b760b48096b1472b92eddd937bd4d61309a7fe086f
data/.gitignore CHANGED
@@ -20,3 +20,14 @@ tmp
20
20
  *.o
21
21
  *.a
22
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,2 +1,4 @@
1
1
  --color
2
- --format progress
2
+ --format progress
3
+ --require spec_helper
4
+ --format documentation
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gemspec
8
8
  #For Testing
9
9
  group :test do
10
10
  gem 'rspec-rails'
11
- gem 'rails', '~> 4.1.1'
11
+ gem 'rails'
12
12
  gem 'coveralls', require: false
13
13
  end
14
14
 
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ![Exception Handler](/readme/title.jpg "Exception Handler Logo")
2
2
 
3
+ <p align="center">
4
+ <strong><a href="#user-content-install">Install</a></strong> - <strong><a href="#user-content-config">Config</a></strong> - <strong><a href="#user-content-support">Support</a></strong>
5
+ </p>
6
+
3
7
  <p align="center">
4
8
  <a href="http://badge.fury.io/rb/exception_handler"><img src="https://badge.fury.io/rb/exception_handler.svg"></a>
5
9
  <a href="https://codeclimate.com/github/richpeck/exception_handler"><img src="https://codeclimate.com/github/richpeck/exception_handler.png"></a>
@@ -10,170 +14,315 @@
10
14
 
11
15
  ----------
12
16
 
13
- **ExceptionHandler** helps you can create custom **404 & 500 production error pages** *(adapted from [**1**](https://gist.github.com/wojtha/8433843) & [**2**](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3))*:
17
+ **ExceptionHandler** helps you can create custom **404 & 500 production error pages** *(adapted from [**1**](https://gist.github.com/wojtha/8433843) & [**2**](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3))*.
14
18
 
15
19
  ![Exceptions_App middleware](/readme/subtitle.jpg)
16
20
 
21
+ **ExceptionHandler** is the *only* production-ready custom error page solution for Rails 4 & 5.
22
+
23
+ ---
24
+
17
25
  <p align="center">
18
- <img src="/readme/titles/custom_error_pages.png" title="Exceptions_App middleware" />
26
+ <br /><img src="/readme/05_title.png" width="450" /><br/>
27
+ <strong>Customize <i>404</i> and <i>500</i> error pages to be branded to your application in production:</strong>
19
28
  </p>
20
29
 
30
+ <p align="center">
31
+ <img src="/readme/check.png" height="22" title="Fully Responsive" align="absmiddle" />&nbsp; <strong>Responsive</strong> &nbsp;
32
+ <img src="/readme/check.png" height="22" title="Branded Error Pages" align="absmiddle" />&nbsp; <strong>Branded Error Pages</strong> &nbsp;
33
+ <img src="/readme/check.png" height="22" title="Middleware Exception Handling" align="absmiddle" />&nbsp; <strong>Middleware Exception Handling</strong> &nbsp;
34
+ <img src="/readme/check.png" height="22" title="Keep Users Informed" align="absmiddle" />&nbsp; <strong>Fully Customizable</strong> &nbsp;
35
+ </p>
36
+
37
+ <p align="center">
38
+ <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" />
39
+ <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" />
40
+ </p>
41
+
42
+ The most feature-rich, stable & effective solution for **custom error pages** in Rails 4 & 5.
43
+
21
44
  ---
22
45
 
23
- **ExceptionHandler** uses the `config.exceptions_app` to catch errors & send them to our [`exceptions` controller](app/controllers/exception_handler/exception_controller.rb). It then extracts data such as `message`, `details`, `user agent`, & populates our `custom view`, storing it in the db:
46
+ <p align="center">
47
+ <img src="readme/05.jpg" title="Reworked for Rails 5" />
48
+ </p>
24
49
 
25
- **40x Errors** | **50x Errors**
26
- --- | ---
27
- ![404 Error Page](/readme/400.jpg "404 Error Page (Uses Application Layout)") | ![500 Error Page](/readme/500.jpg "500 Error Page (Uses Error Layout)")
28
- **layouts/application.html.erb** | **layouts/errors.html.erb**
50
+ <p align="center">
51
+ <img src="readme/titles/reworked.jpg" title="Reworked for Rails 5" width="450" />
52
+ </p>
29
53
 
54
+ <p align="center">
55
+ <img src="/readme/check_02.png" height="22" title="New Controller" align="absmiddle" />&nbsp; <strong>New Controller</strong> &nbsp;
56
+ <img src="/readme/check_02.png" height="22" title="New Middleware" align="absmiddle" />&nbsp; <strong>New Middleware</strong> &nbsp;
57
+ <img src="/readme/check_02.png" height="22" title="Full Test Suite" align="absmiddle" />&nbsp; <strong>Full Test Suite</strong> &nbsp;
58
+ <img src="/readme/check_02.png" height="22" title="Rails 4 & 5 Compatible" align="absmiddle" />&nbsp; <strong>FULLY Rails 4 & 5 Compatible</strong> &nbsp;
59
+ </p>
30
60
 
31
- All exceptions in Rails are handled by the [**`ActiveDispatch::ShowExceptions`**](https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_dispatch/middleware/show_exceptions.rb) middleware.
61
+ Brand new `controller`, `middleware` & options have made **`ExceptionHandler`** even more powerful & efficient. Now you can use `ExceptionHandler` directly with a single click -- **plug and play** custom exception pages:
32
62
 
33
- This is invoked through a hook called **`config.exceptions_app`**, accessed through the `environment` files of rails `application.rb`, `environments/development.rb`, `environments/production.rb` etc.
63
+ <div align="center">
64
+ <img src="/readme/400.jpg" title="400 Errors" width="435" />
65
+ <img src="/readme/500.jpg" title="500 Errors" width="435" />
66
+ </div>
34
67
 
35
- Simply, it gives you a concise, robust way to access all the data of an exception, pushing your app to the next level in branding and usability. There is no other system like this for Rails. `ExceptionHandler` is the *only* Rails production exception handling solution, giving you complete control over the feel of your application, even when it fails:
68
+ **ExceptionHandler** uses `config.exceptions_app` to catch & send errors to the [`exceptions` controller](app/controllers/exception_handler/exception_controller.rb).
36
69
 
37
- ![Parse](/readme/parser.jpg "Parser")
70
+ It uses data stored in `Rack` (`message`, `details`, `user agent`) to populate its `custom view`. This gives you the ability to **maintain your branding** *even* when your app experiences an exception.
38
71
 
39
- ----------
72
+ ----
40
73
 
41
- <img src="/readme/titles/contents.png" title="Contents" />
74
+ <p align="center">
75
+ <br />
76
+ <img src="/readme/titles/middleware.jpg" title="Middleware Powered Exceptions" width="300" />
77
+ <br />
78
+ </p>
79
+
80
+ The power of **`ExceptionHandler`** lies in its capacity to access the [**`ActiveDispatch::ShowExceptions`**](https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_dispatch/middleware/show_exceptions.rb) middleware:
81
+
82
+ <p align="center">
83
+ <img src="/readme/middleware.jpg" title="Exceptions handled by the ActiveDispatch::ShowExceptions Middleware" />
84
+ </p>
85
+
86
+ Rails invokes [`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration) whenever an exception is raised.
87
+
88
+ **ExceptionHandler** injects our `ExceptionController` into this hook to provide the most efficient response:
89
+
90
+ > **`config.exceptions_app`** sets the exceptions application invoked by the **`ShowException`** middleware when an exception happens. Defaults to **`ActionDispatch::PublicExceptions.new(Rails.public_path)`**.
42
91
 
43
- - [**Installation**](https://github.com/richpeck/exception_handler#installation)
44
- - [Config](https://github.com/richpeck/exception_handler#config)
45
- - [DB](https://github.com/richpeck/exception_handler#db)
46
- - [Views](https://github.com/richpeck/exception_handler#views)
47
- - [Layout](https://github.com/richpeck/exception_handler#layout)
48
- - [**Testing**](https://github.com/richpeck/exception_handler#testing)
49
- - [**Bugs**](https://github.com/richpeck/exception_handler#bugs)
50
- - [**Support**](https://github.com/richpeck/exception_handler#support)
51
- - [**Contribution**](https://github.com/richpeck/exception_handler#contribution)
92
+ <p align="center">
93
+ <img src="readme/exceptions_app.jpg" title="Exceptions App" />
94
+ </p>
95
+
96
+ As opposed to other exception suites (which use the `routes`), this gives you DIRECT access to the exception through the middleware stack, straight to the [`ExceptionController`](/app/controllers/exception_handler/exception_controller.rb):
97
+
98
+ <p align="center">
99
+ <img src="readme/controller_middleware.jpg" title="ExceptionsController compiles the exception & delivers to the front-end" />
100
+ </p>
101
+
102
+ **ExceptionHandler** uses [custom middleware](https://github.com/richpeck/exception_handler/blob/0.5/lib/exception_handler/parse.rb) to extract *all* the exception data for the request. Not only is this the most succinct, efficient way to do this, it also allows you to customize the *entire* fault-recovery process.
103
+
104
+ It's completely unique - the **only** professional solution to catch, process & handle exceptions in Rails.
52
105
 
53
106
  ----------
54
107
 
55
- ## Installation
108
+ <p align="center" id="install">
109
+ <br />
110
+ <img src="readme/titles/install.jpg" title="1 Click Install for ExceptionHandler 5 on Rails 5" width="350" />
111
+ <br />
112
+ <strong>You Don't Need <i>Any</i> Configuration To Run ExceptionHandler</strong>
113
+ </p>
114
+
115
+ gem install "exception_handler"
116
+
117
+ or
56
118
 
57
- gem install 'exception_handler'
58
-
59
- or
119
+ gem 'exception_handler', '~> 0.5.0' #-> Gemfile
60
120
 
61
- gem 'exception_handler', '~> 0.4.6' # Gemfile
121
+ `ExceptionHandler`'s new **config** system (introduced in [`0.4.7`](https://github.com/richpeck/exception_handler/wiki/Setup)) stores all the [defaults](#user-content-defaults) - you just need to install the gem & let it run.
62
122
 
63
- <a href="https://rubygems.org/gems/exception_handler" style="text-align: center">
64
- You can see `ExceptionHandler` on RubyGems
123
+ If you want to change *any* settings (detailed [below](#user-content-config)), you **simply** need to change `config/application.rb` / `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.
124
+
125
+ <p align="center">
126
+ <a href="http://rubygems.org/gems/exception_handler" target="_blank">
127
+ <img src="/readme/rubygems.jpg" title="30,000+ Downloads Through RubyGems" />
128
+ <br />
129
+ </a>
130
+ </p>
131
+
132
+ ----
133
+
134
+ <p align="center" id="config">
65
135
  <br />
66
- <img src="/readme/rubygems.jpg" />
67
- </a>
136
+ <img src="readme/titles/config.jpg" title="Instant Custom Error Pages For Rails 4 & 5" width="325" />
137
+ </p>
68
138
 
69
- ----------
139
+ **`ExceptionHandler 0.5`** has the SIMPLEST config possible...
70
140
 
71
- ##### Config
141
+ <p align="center">
142
+ <img src="/readme/config_defaults.jpg" title="ExceptionHandler Default Configuration Options">
143
+ </p>
72
144
 
73
- If you wish to change any of the default settings (below), you should now add `config.exception_handler` to your `config/application.rb` or `config/production.rb` file:
145
+ The MAGIC is that it uses [`environment files`](http://guides.rubyonrails.org/configuring.html#creating-rails-environments).
74
146
 
75
- ![Config Options](/readme/config.jpg)
147
+ You can apply the above options to any of Rails' environment files, allowing you to customize the `ExceptionHandler` gem without inducing ANY overhead. `Initializer` files just get in the way.
76
148
 
149
+ > **IMPORTANT**
150
+ >
151
+ > If you're upgrading from >= `0.4.7`, you need to **remove your `exception_handler` initializer**.
152
+ >
153
+ > We've changed the load process to use Rails app config - **you don't need the `exception_handler` initializer any more**
77
154
 
78
- **IMPORTANT**
155
+ ----
79
156
 
80
- If you're upgrading to `0.4.6`, you need to remove your `exception_handler` initializer.
157
+ <br />
158
+ <img src="readme/titles/defaults.jpg" title="Defaults" id="defaults" />
81
159
 
82
- We've changed the load process to use Rails app `config` - **you don't need the `exception_handler` initializer any more**
160
+ As can be seen in the [`config class`](/lib/exception_handler/config.rb), the following are all the options `exception_handler` accepts:
83
161
 
84
- ----------
162
+ <p align="center">
163
+ <img src="/readme/defaults.jpg" title="ExceptionHandler Default Configuration Options">
164
+ </p>
85
165
 
86
- ##### DB
166
+ # config.rb
167
+ DEFAULTS = {
168
+ dev: false, #-> defaults to "false" for dev mode
169
+ db: false, #-> defaults to :errors if true, else input "table_name" as string
170
+ email: false, #-> need to integrate
171
+ social: {
172
+ :facebook => 'frontline.utilities', #-> Facebook handle
173
+ :twitter => 'frontlineutils', #-> Twitter handle
174
+ :youtube => 'frontlineutils', #-> YouTube handle
175
+ :linkedin => 'frontline-utilities', #-> LinkedIn handle
176
+ :fusion => 'frontlineutils', #-> Fusion handle
177
+ :url => {
178
+ :facebook => 'https://facebook.com', #-> no need to edit
179
+ :twitter => 'http://twitter.com', #-> no need to edit
180
+ :youtube => 'https://youtube.com/user', #-> no need to edit
181
+ :linkedin => 'https://linkedin.com/company', #-> no need to edit
182
+ :fusion => 'https://frontlinefusion.com', #-> no need to edit
183
+ },
184
+ },
185
+ layouts: {
186
+ '404' => nil, #-> 404 Callback (needs improving big time) Use the following: '404' => <<-EOF redirect_to root_url, notice: "Hello" EOF
187
+ '400' => nil, #-> layout for 400 error code (404 should only be used as response)
188
+ '500' => 'exception'
189
+ },
190
+ }
87
191
 
88
- If you want to store exceptions in the db, you will need to set up a `migration`:
192
+ The above are ***defaults***.
89
193
 
90
- $ rails generate exception_handler:migration
91
- $ rake db:migrate
194
+ You can change the options for each [`environment file`](http://guides.rubyonrails.org/configuring.html#creating-rails-environments):
92
195
 
93
- ![Database](/readme/db.jpg "Database")
196
+ - `config/application.rb`
197
+ - `config/environments/development.rb`
198
+ - `config/environments/production.rb`
199
+ - `config/environments/staging.rb`
94
200
 
95
- You will also need to ensure your config `db` option is either `true` || `:table_name`:
201
+ 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.
96
202
 
97
- ![Database Edit](/readme/db_edit.jpg "Database Edit")
203
+ ----
98
204
 
99
- ----------
205
+ <br />
206
+ <img src="readme/titles/dev.jpg" title="Development Mode (New!!!)" id="dev" />
100
207
 
101
- ##### Views
208
+ Want to test in the `dev` environment?
102
209
 
103
- If you want to change the views, you can have them put into your app:
210
+ #config/application.rb
211
+ config.exception_handler = {
212
+ dev: true # -> Runs in development mode WITHOUT changing the app environment files
213
+ }
104
214
 
105
- $ rails generate exception_handler:views #-> controller, models, helpers, views & assets
106
- $ rails generate exception_handler:views -v views controllers models helpers assets #-> remove as appropriate to install individual assets
215
+ <img src="/readme/dev.jpg" title="ExceptionHandler Dev Mode - NEW!!!!!">
107
216
 
108
- The views will be appended to your app, and you'll be able to edit them as required.
217
+ [`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`:
109
218
 
110
- ---
219
+ > **`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.
220
+
221
+
222
+ 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`.
111
223
 
112
- ##### Show
224
+ ----
113
225
 
114
- ![View](/readme/view.jpg "View")
226
+ <br />
227
+ <img src="readme/titles/layout.jpg" title="Layout" id="layout" />
115
228
 
116
- The view is located in `app/views/exception_handler/show.html.erb` designed to work for all exceptions.
229
+ One of the most critial aspects of **`ExceptionHandler`** is the custom `Exception` layout.
230
+
231
+ If you want to change the layout (for `500` error pages), you need to use the following:
232
+
233
+ <img src="readme/layout.jpg" title="Custom Exceptions Layout For ExceptionHandler" />
234
+
235
+ You'll need to [generate](#user-content-view) it into your application before being able to edit:
236
+
237
+ ----
238
+
239
+ <br />
240
+ <img src="readme/titles/view.jpg" title="Views" id="view" />
241
+
242
+ **`ExceptionHandler`** comes with its own inbuilt views & controller.
243
+
244
+ 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)
245
+
246
+ $ rails generate exception_handler:views #-> controller, models, helpers, views & assets
247
+ $ rails generate exception_handler:views -v views controllers models helpers assets #-> remove as appropriate to install individual assets
248
+
249
+ --
250
+
251
+ <img src="readme/show.jpg" title="ExceptionHandler Show view" />
252
+
253
+ `ExceptionHandler` uses `exceptions#show` -- located in **`app/views/exception_handler/show.html.erb`** designed to work for all exceptions.
117
254
 
118
255
  By default, it is split for use with different layouts, data being available to both.
119
256
 
120
- This works exactly the same as the other views in your app (IE the `exceptions` controller invokes the `show` action)
257
+ This works exactly the same as the other views in your app (IE the `exceptions controller` invokes the `show` action)
121
258
 
122
- ----------
259
+ ----
123
260
 
124
- ##### Layout
261
+ <br />
262
+ <img src="readme/titles/db.jpg" title="Database" id="db" />
125
263
 
126
- One of the most critial aspects of **ExceptionHandler** is the [custom `Exception` layout](/app/controllers/exception_handler/exception_controller.rb).
264
+ If you want to store exceptions in your `db`, you will need to set up a **migration**:
127
265
 
128
- If you want to change the layout (for 500 error pages), you need to use the following:
266
+ $ rails generate exception_handler:migration
267
+ $ rake db:migrate
129
268
 
130
- ![Layout](/readme/layout.jpg "Layout")
269
+ You will also need to ensure your config db option is either `true` or `"table_name"`:
131
270
 
132
- ----------
271
+ <img src="/readme/db.jpg" title="ExceptionHandler DB Config">
133
272
 
134
- <img src="/readme/titles/testing.png" id="testing" />
273
+ <img src="/readme/db_screenshot.jpg" title="ExceptionHandler Database">
135
274
 
136
- `config.exceptions_app` is only used in Rails' **production** environment.
275
+ > **IMPORTANT**
276
+ >
277
+ > `ExceptionHandler`'s [new config system](https://github.com/richpeck/exception_handler/wiki/Setup) is `environment` agnostic.
278
+ >
279
+ > **Where you declare your `db` setting will change depending on your environment**
280
+ >
281
+ > 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*.
137
282
 
138
- If you wish to test the gem in dev, you'll need to make your app process requests as production for now. This is a temporary step, and will be resolved in a new version:
283
+ ----
139
284
 
140
- ![#config/environments/development.rb](/readme/dev.jpg "Developer Testing")
285
+ <p align="center" id="support">
286
+ <br />
287
+ <img src="readme/titles/support.jpg" title="1hr & 24 hr Support" width="225" />
288
+ </p>
141
289
 
142
- You should change this setting if you wish to test your styling in development mode. It should be temporary (you need to change it back once you have it looking how you like)
290
+ Github Issue (1hr) | Stackoverflow (24hrs)
291
+ :----: | :----:
292
+ [![StackOverflow](/readme/github.jpg)](https://github.com/richpeck/exception_handler/issues) | [![StackOverflow](/readme/stackoverflow.jpg)](http://stackoverflow.com/questions/ask?tags=ruby-on-rails+exception-handler)
143
293
 
144
- ----------
294
+ We use **`ExceptionHandler`** in production, so we have a vested interest in keeping it running smoothly.
145
295
 
146
- <img src="readme/titles/bugs.png" id="bugs" />
296
+ Asking in either of the above services will give you a response. Don't be shy, we want to make this the best `exception handling` middleware for Rails.
147
297
 
148
- 1. `ApplicationController`
298
+ --
149
299
 
150
- ![ApplicationController](/readme/application_controller.jpg "Application Controller")
151
-
152
- A significant issue exists in respect to the inheritance of `exceptions_controller`.
153
- Our current version (`0.4`) inherits from the `ApplicationController`. This causes a problem for many applications.
300
+ <br />
301
+ <img src="readme/titles/changelog.jpg" title="Changelog" id="changelog" />
154
302
 
155
- If you use any sort of `before_action` callback in your controller, especially to populate variables, this
156
- will cause untold problems in your `exceptions_controller`.
303
+ #### 0.5.1
304
+ - Next release
157
305
 
158
- `500` errors are server faults; trying to get the server to call more data will simply not work. It causes
159
- an exception loop, leading to catastrophic failure.
306
+ #### 0.5.0
307
+ - Added locales
308
+ - Email notifications
309
+ - Full test suite (finally)
310
+ - Rails 4.2 & Rails 5.0 native ([`request.env`](https://github.com/rails/rails/commit/05934d24aff62d66fc62621aa38dae6456e276be) fix)
311
+ - Controller fixed
312
+ - `DB` fixed
313
+ - Legacy initializer support ([more](https://github.com/richpeck/exception_handler/wiki/Setup))
314
+ - Rails asset management improvement
315
+ - Cut out most dev files from gem (drastic reduction in gem size)
160
316
 
161
317
 
162
- ----------
318
+ #### 0.4.7
163
319
 
164
- <img src="readme/titles/support.png" id="support" />
320
+ - New config system ([more](https://github.com/richpeck/exception_handler/wiki/Setup))
321
+ - Fixed controller layout issues
322
+ - Streamlined middleware
323
+ - New layout & interface implementation
165
324
 
166
- - Watch the video tutorial (soon)
167
- - [Create an "issue"](https://github.com/richpeck/exception_handler/issues)
168
- - Contact support (soon)
169
- - [Ask on StackOverflow](http://stackoverflow.com/questions/ask?tags=exception_handler&ruby_on_rails)
170
325
 
171
326
  ----------
172
327
 
173
- <img src="readme/titles/contribution.png" id="contribution" />
174
-
175
- 1. Fork it ( https://github.com/richpeck/exception_handler/fork )
176
- 2. Create your feature branch (`git checkout -b my-new-feature`)
177
- 3. Commit your changes (`git commit -am 'Add some feature'`)
178
- 4. Push to the branch (`git push origin my-new-feature`)
179
- 5. Create a new Pull Request
328
+ &copy; 2016 [**R Peck**](http://stackoverflow.com/users/1143732/richard-peck) for [**FL**](http://frontlineutilities.co.uk)