exception_handler 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +211 -211
- data/app/controllers/exception_handler/exception_controller.rb +2 -2
- data/app/views/exception_handler/exception/show.html.erb +27 -0
- data/app/views/layouts/error.html.erb +83 -0
- data/exception_handler.gemspec +26 -28
- data/lib/exception_handler/version.rb +1 -1
- metadata +4 -32
- data/app/views/exception_handler/exception/show.html.haml +0 -18
- data/app/views/layouts/error.html.haml +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6c96459a17b1f0fc5005d041d6173244854c28b
|
4
|
+
data.tar.gz: e5c1fb9a25b2432616856a9a0bea3f9cf4d986cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 232df1455edd39865a41b6b8d5cc7a629ad451849e6a249e4e804a89a5ada163afd06b618318f724d63d42ad43ebc5e06d46a58383f008db689624069bd2303a
|
7
|
+
data.tar.gz: 2ebcee4d313758aa654766d00ee1ed3f0e1a05f36a3fa265774422b3ed489d8c794a1ac55f9aa3e23a0f218aec617531400276392f0b962682c23ff9be070437
|
data/README.md
CHANGED
@@ -1,211 +1,211 @@
|
|
1
|
-
# [![Exception Handler](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/exception_handler.png "Exception Handler Logo")](http://frontlineutilities.co.uk/ruby-on-rails/exception-handler)
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/exception_handler.svg)](http://badge.fury.io/rb/exception_handler)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/richpeck/exception_handler.png)](https://codeclimate.com/github/richpeck/exception_handler)
|
5
|
-
[![Dependency Status](https://gemnasium.com/richpeck/exception_handler.svg)](https://gemnasium.com/richpeck/exception_handler)
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/richpeck/exception_handler/badge.png)](https://coveralls.io/r/richpeck/exception_handler)
|
7
|
-
[![Build Status](https://travis-ci.org/richpeck/exception_handler.svg?branch=master)](https://travis-ci.org/richpeck/exception_handler)
|
8
|
-
|
9
|
-
|
10
|
-
[**ExceptionHandler** Rails Gem](https://rubygems.org/gems/exception_handler) (adapted from [this tutorial](https://gist.github.com/wojtha/8433843) & [this tutorial](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3))
|
11
|
-
|
12
|
-
Works with the [`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration) hook in Rails' middleware stack:
|
13
|
-
|
14
|
-
config.exceptions_app sets the exceptions application invoked by the ShowExceptionmiddleware
|
15
|
-
when an exception happens. Defaults to ActionDispatch::PublicExceptions.new(Rails.public_path).
|
16
|
-
|
17
|
-
-----------
|
18
|
-
|
19
|
-
####Custom Error Pages
|
20
|
-
|
21
|
-
`ExceptionHandler` deploys *custom error pages*. These allow you to serve your own design error pages in production; showing both the error, and the problem. This is a big step forward from the standard Rails error reporting facility
|
22
|
-
|
23
|
-
There are two types of error page:
|
24
|
-
|
25
|
-
- 404 errors
|
26
|
-
- 500 errors (+ other)
|
27
|
-
|
28
|
-
The custom **`404`** error uses your own `layout`. The **`500 & other errors`** are `server` issues, and so we have included an `errors` layout (`/views/layouts/errors.html.
|
29
|
-
|
30
|
-
The `errors` layout in important. If you try and load your "standard" layout with an internal server error, all your
|
31
|
-
"supporting" functionality is called too. Problem? You're likely going to cause even more errors.
|
32
|
-
|
33
|
-
**Custom error pages** are included by default.
|
34
|
-
You can change them by using the **`rails generate exception_handler:assets --views`**:
|
35
|
-
|
36
|
-
**500 Errors** | **404 Errors**
|
37
|
-
--- | ---
|
38
|
-
![500 Server Error Pages](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/500.png "500 Server Error Page") | ![404 Server Error Pages](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/404.png "404 Server Error Page")
|
39
|
-
Uses **errors** layout | Uses **standard** layout
|
40
|
-
|
41
|
-
-----------
|
42
|
-
|
43
|
-
####Saving Errors To DB
|
44
|
-
|
45
|
-
Adapted & refactored from [this tutorial](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3)
|
46
|
-
|
47
|
-
Sometimes, you want to save your errors to your database (admin areas, multi-tenant apps, etc). We've included some middleware which captures the exceptions & saves them to the db:
|
48
|
-
|
49
|
-
- Model (class) Name
|
50
|
-
- Error Message
|
51
|
-
- Stack trace
|
52
|
-
- Target URL
|
53
|
-
- Referrer URL
|
54
|
-
- Params
|
55
|
-
- User Agent (Browser Details)
|
56
|
-
|
57
|
-
This db allows you to track, read & repair errors in your application on the fly. We deploy this in our admin areas, to help us
|
58
|
-
appreciate any issues on our client apps.
|
59
|
-
|
60
|
-
![Errors Table](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/db.png "Errors Table")
|
61
|
-
|
62
|
-
This functionality is **`disabled`** by default
|
63
|
-
|
64
|
-
To enable, you need to do the following:
|
65
|
-
|
66
|
-
- rails generate exception_handler:install #-> will install config initializer
|
67
|
-
- rails generate exception_handler:migration #-> will create migration (for `errors` table)
|
68
|
-
- rake db:migrate #-> creates `errors` table
|
69
|
-
|
70
|
-
- config/initializers/exception_handler.rb
|
71
|
-
- ExceptionHandler.setup do |config|
|
72
|
-
- config.db = true
|
73
|
-
- end
|
74
|
-
|
75
|
-
---------
|
76
|
-
|
77
|
-
## Installation
|
78
|
-
|
79
|
-
###Step1
|
80
|
-
|
81
|
-
You need to reference the [`exception_handler`](http://rubygems.org/gems/exception_handler) gem. Once you have downloaded the gem, you'll be able to deploy it in your application.
|
82
|
-
|
83
|
-
Add this line to your application's Gemfile:
|
84
|
-
|
85
|
-
gem 'exception_handler'
|
86
|
-
|
87
|
-
And then execute:
|
88
|
-
|
89
|
-
$ bundle
|
90
|
-
|
91
|
-
**Or** install it yourself as:
|
92
|
-
|
93
|
-
$ gem install exception_handler
|
94
|
-
|
95
|
-
![gem install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/gem_install.png "gem install")
|
96
|
-
|
97
|
-
--
|
98
|
-
|
99
|
-
###Step2
|
100
|
-
|
101
|
-
Run:
|
102
|
-
|
103
|
-
rails generate exception_handler:install
|
104
|
-
|
105
|
-
![Installation](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install.png "Installation")
|
106
|
-
|
107
|
-
This will create `config/initializers/exception_handler.rb`. Whilst not vital, it will give you
|
108
|
-
access to the configuration options which can change the gem's behavior:
|
109
|
-
|
110
|
-
![Config File](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/config.png "Configuration")
|
111
|
-
|
112
|
-
--
|
113
|
-
|
114
|
-
###Database
|
115
|
-
|
116
|
-
If you want to set up the database, you will need to use the `migration installer`:
|
117
|
-
|
118
|
-
$ rails generate exception_handler:migration
|
119
|
-
|
120
|
-
This creates:
|
121
|
-
|
122
|
-
$ rake db:migrate
|
123
|
-
|
124
|
-
This will migrate the datatable for you. Now you need to change `config.db = true`
|
125
|
-
|
126
|
-
![DB Config](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/config_db.png "Config DB")
|
127
|
-
|
128
|
-
|
129
|
-
---------
|
130
|
-
|
131
|
-
###Configuration
|
132
|
-
|
133
|
-
[Exception handler](https://rubygems.org/gems/exception_handler) comes with 3 installers
|
134
|
-
|
135
|
-
**You only need to use `rails generate exception_handler:install`**. The others allow you to include files on your system, or create the `errors` table.
|
136
|
-
|
137
|
-
# General
|
138
|
-
$ rails generate exception_handler:install #-> installs "config" file (initializer)
|
139
|
-
|
140
|
-
![Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install.png "Standard Install")
|
141
|
-
|
142
|
-
|
143
|
-
# Migration
|
144
|
-
$ rails generate exception_handler:migration #-> generates migration for "errors" table
|
145
|
-
|
146
|
-
![Migration Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install_migration.png "Migration Install")
|
147
|
-
|
148
|
-
|
149
|
-
# Files
|
150
|
-
$ rails generate exception_handler:views #-> controller, models, views & assets
|
151
|
-
$ rails generate exception_handler:views -v views controllers models assets #-> remove as appropriate to install individual assets
|
152
|
-
|
153
|
-
![Views Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install_views.png "Views Install")
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
---------
|
158
|
-
|
159
|
-
## Usage
|
160
|
-
|
161
|
-
###Development Environment
|
162
|
-
|
163
|
-
**[`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration)** is only used in Rails' production environment. Therefore, if you wish to **test the gem in dev**,
|
164
|
-
you'll need to make your app process requests as `production` for now. This is a temporary step, and will be
|
165
|
-
resolved in a new version:
|
166
|
-
|
167
|
-
#config/environments/development.rb
|
168
|
-
config.consider_all_requests_local = false # true
|
169
|
-
|
170
|
-
![Development Testing](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/development.png "Development Testing")
|
171
|
-
|
172
|
-
You should change this setting if you wish to test your styling in development mode. Please note **it should be temporary**
|
173
|
-
|
174
|
-
--
|
175
|
-
|
176
|
-
###Production Environment
|
177
|
-
|
178
|
-
No action required
|
179
|
-
|
180
|
-
---------
|
181
|
-
|
182
|
-
###Demo
|
183
|
-
|
184
|
-
**404 Error** | **500 Error**
|
185
|
-
:---: | :---:
|
186
|
-
[![404 Error Page](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/404_demo.png "404 Error Page Demo")](http://firststopcosmeticshop.co.uk/sdfsdf/sdf/sdfsdf) | [![500 Error Page](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/500_demo.png "500 Error Page Demo")](http://firststopcosmeticshop.co.uk/search/fasdfasdfasdfasdfasdf)
|
187
|
-
[Link](http://firststopcosmeticshop.co.uk/sdfsdf/sdf/sdfsdf) | [Link](http://firststopcosmeticshop.co.uk/search/fasdfasdfasdfasdfasdf)
|
188
|
-
|
189
|
-
|
190
|
-
--------
|
191
|
-
|
192
|
-
## Support
|
193
|
-
|
194
|
-
If you need help, you may consider:
|
195
|
-
|
196
|
-
1. Watching this [**video tutorial**](http://www.youtube.com/watch?v=Zo2vav3dYnY):
|
197
|
-
|
198
|
-
[![ExceptionHandler Update](http://img.youtube.com/vi/Zo2vav3dYnY/0.jpg)](http://www.youtube.com/watch?v=Zo2vav3dYnY)
|
199
|
-
2. Read [**our tutorial**](http://google.com)
|
200
|
-
3. Ask on [**StackOverflow**](http://stackoverflow.com)
|
201
|
-
4. Go on the [**gem support page**](http://frontlineutilities.co.uk)
|
202
|
-
|
203
|
-
---------
|
204
|
-
|
205
|
-
## Contributing
|
206
|
-
|
207
|
-
1. Fork it ( https://github.com/richpeck/exception_handler/fork )
|
208
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
209
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
210
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
211
|
-
5. Create a new Pull Request
|
1
|
+
# [![Exception Handler](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/exception_handler.png "Exception Handler Logo")](http://frontlineutilities.co.uk/ruby-on-rails/exception-handler)
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/exception_handler.svg)](http://badge.fury.io/rb/exception_handler)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/richpeck/exception_handler.png)](https://codeclimate.com/github/richpeck/exception_handler)
|
5
|
+
[![Dependency Status](https://gemnasium.com/richpeck/exception_handler.svg)](https://gemnasium.com/richpeck/exception_handler)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/richpeck/exception_handler/badge.png)](https://coveralls.io/r/richpeck/exception_handler)
|
7
|
+
[![Build Status](https://travis-ci.org/richpeck/exception_handler.svg?branch=master)](https://travis-ci.org/richpeck/exception_handler)
|
8
|
+
|
9
|
+
|
10
|
+
[**ExceptionHandler** Rails Gem](https://rubygems.org/gems/exception_handler) (adapted from [this tutorial](https://gist.github.com/wojtha/8433843) & [this tutorial](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3))
|
11
|
+
|
12
|
+
Works with the [`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration) hook in Rails' middleware stack:
|
13
|
+
|
14
|
+
config.exceptions_app sets the exceptions application invoked by the ShowExceptionmiddleware
|
15
|
+
when an exception happens. Defaults to ActionDispatch::PublicExceptions.new(Rails.public_path).
|
16
|
+
|
17
|
+
-----------
|
18
|
+
|
19
|
+
####Custom Error Pages
|
20
|
+
|
21
|
+
`ExceptionHandler` deploys *custom error pages*. These allow you to serve your own design error pages in production; showing both the error, and the problem. This is a big step forward from the standard Rails error reporting facility
|
22
|
+
|
23
|
+
There are two types of error page:
|
24
|
+
|
25
|
+
- 404 errors
|
26
|
+
- 500 errors (+ other)
|
27
|
+
|
28
|
+
The custom **`404`** error uses your own `layout`. The **`500 & other errors`** are `server` issues, and so we have included an `errors` layout (`/views/layouts/errors.html.erb`).
|
29
|
+
|
30
|
+
The `errors` layout in important. If you try and load your "standard" layout with an internal server error, all your
|
31
|
+
"supporting" functionality is called too. Problem? You're likely going to cause even more errors.
|
32
|
+
|
33
|
+
**Custom error pages** are included by default.
|
34
|
+
You can change them by using the **`rails generate exception_handler:assets --views`**:
|
35
|
+
|
36
|
+
**500 Errors** | **404 Errors**
|
37
|
+
--- | ---
|
38
|
+
![500 Server Error Pages](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/500.png "500 Server Error Page") | ![404 Server Error Pages](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/404.png "404 Server Error Page")
|
39
|
+
Uses **errors** layout | Uses **standard** layout
|
40
|
+
|
41
|
+
-----------
|
42
|
+
|
43
|
+
####Saving Errors To DB
|
44
|
+
|
45
|
+
Adapted & refactored from [this tutorial](http://www.sharagoz.com/posts/1-rolling-your-own-exception-handler-in-rails-3)
|
46
|
+
|
47
|
+
Sometimes, you want to save your errors to your database (admin areas, multi-tenant apps, etc). We've included some middleware which captures the exceptions & saves them to the db:
|
48
|
+
|
49
|
+
- Model (class) Name
|
50
|
+
- Error Message
|
51
|
+
- Stack trace
|
52
|
+
- Target URL
|
53
|
+
- Referrer URL
|
54
|
+
- Params
|
55
|
+
- User Agent (Browser Details)
|
56
|
+
|
57
|
+
This db allows you to track, read & repair errors in your application on the fly. We deploy this in our admin areas, to help us
|
58
|
+
appreciate any issues on our client apps.
|
59
|
+
|
60
|
+
![Errors Table](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/db.png "Errors Table")
|
61
|
+
|
62
|
+
This functionality is **`disabled`** by default
|
63
|
+
|
64
|
+
To enable, you need to do the following:
|
65
|
+
|
66
|
+
- rails generate exception_handler:install #-> will install config initializer
|
67
|
+
- rails generate exception_handler:migration #-> will create migration (for `errors` table)
|
68
|
+
- rake db:migrate #-> creates `errors` table
|
69
|
+
|
70
|
+
- config/initializers/exception_handler.rb
|
71
|
+
- ExceptionHandler.setup do |config|
|
72
|
+
- config.db = true
|
73
|
+
- end
|
74
|
+
|
75
|
+
---------
|
76
|
+
|
77
|
+
## Installation
|
78
|
+
|
79
|
+
###Step1
|
80
|
+
|
81
|
+
You need to reference the [`exception_handler`](http://rubygems.org/gems/exception_handler) gem. Once you have downloaded the gem, you'll be able to deploy it in your application.
|
82
|
+
|
83
|
+
Add this line to your application's Gemfile:
|
84
|
+
|
85
|
+
gem 'exception_handler'
|
86
|
+
|
87
|
+
And then execute:
|
88
|
+
|
89
|
+
$ bundle
|
90
|
+
|
91
|
+
**Or** install it yourself as:
|
92
|
+
|
93
|
+
$ gem install exception_handler
|
94
|
+
|
95
|
+
![gem install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/gem_install.png "gem install")
|
96
|
+
|
97
|
+
--
|
98
|
+
|
99
|
+
###Step2
|
100
|
+
|
101
|
+
Run:
|
102
|
+
|
103
|
+
rails generate exception_handler:install
|
104
|
+
|
105
|
+
![Installation](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install.png "Installation")
|
106
|
+
|
107
|
+
This will create `config/initializers/exception_handler.rb`. Whilst not vital, it will give you
|
108
|
+
access to the configuration options which can change the gem's behavior:
|
109
|
+
|
110
|
+
![Config File](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/config.png "Configuration")
|
111
|
+
|
112
|
+
--
|
113
|
+
|
114
|
+
###Database
|
115
|
+
|
116
|
+
If you want to set up the database, you will need to use the `migration installer`:
|
117
|
+
|
118
|
+
$ rails generate exception_handler:migration
|
119
|
+
|
120
|
+
This creates:
|
121
|
+
|
122
|
+
$ rake db:migrate
|
123
|
+
|
124
|
+
This will migrate the datatable for you. Now you need to change `config.db = true`
|
125
|
+
|
126
|
+
![DB Config](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/config_db.png "Config DB")
|
127
|
+
|
128
|
+
|
129
|
+
---------
|
130
|
+
|
131
|
+
###Configuration
|
132
|
+
|
133
|
+
[Exception handler](https://rubygems.org/gems/exception_handler) comes with 3 installers
|
134
|
+
|
135
|
+
**You only need to use `rails generate exception_handler:install`**. The others allow you to include files on your system, or create the `errors` table.
|
136
|
+
|
137
|
+
# General
|
138
|
+
$ rails generate exception_handler:install #-> installs "config" file (initializer)
|
139
|
+
|
140
|
+
![Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install.png "Standard Install")
|
141
|
+
|
142
|
+
|
143
|
+
# Migration
|
144
|
+
$ rails generate exception_handler:migration #-> generates migration for "errors" table
|
145
|
+
|
146
|
+
![Migration Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install_migration.png "Migration Install")
|
147
|
+
|
148
|
+
|
149
|
+
# Files
|
150
|
+
$ rails generate exception_handler:views #-> controller, models, views & assets
|
151
|
+
$ rails generate exception_handler:views -v views controllers models assets #-> remove as appropriate to install individual assets
|
152
|
+
|
153
|
+
![Views Install](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/install_views.png "Views Install")
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
---------
|
158
|
+
|
159
|
+
## Usage
|
160
|
+
|
161
|
+
###Development Environment
|
162
|
+
|
163
|
+
**[`config.exceptions_app`](http://guides.rubyonrails.org/configuring.html#rails-general-configuration)** is only used in Rails' production environment. Therefore, if you wish to **test the gem in dev**,
|
164
|
+
you'll need to make your app process requests as `production` for now. This is a temporary step, and will be
|
165
|
+
resolved in a new version:
|
166
|
+
|
167
|
+
#config/environments/development.rb
|
168
|
+
config.consider_all_requests_local = false # true
|
169
|
+
|
170
|
+
![Development Testing](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/development.png "Development Testing")
|
171
|
+
|
172
|
+
You should change this setting if you wish to test your styling in development mode. Please note **it should be temporary**
|
173
|
+
|
174
|
+
--
|
175
|
+
|
176
|
+
###Production Environment
|
177
|
+
|
178
|
+
No action required
|
179
|
+
|
180
|
+
---------
|
181
|
+
|
182
|
+
###Demo
|
183
|
+
|
184
|
+
**404 Error** | **500 Error**
|
185
|
+
:---: | :---:
|
186
|
+
[![404 Error Page](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/404_demo.png "404 Error Page Demo")](http://firststopcosmeticshop.co.uk/sdfsdf/sdf/sdfsdf) | [![500 Error Page](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/500_demo.png "500 Error Page Demo")](http://firststopcosmeticshop.co.uk/search/fasdfasdfasdfasdfasdf)
|
187
|
+
[Link](http://firststopcosmeticshop.co.uk/sdfsdf/sdf/sdfsdf) | [Link](http://firststopcosmeticshop.co.uk/search/fasdfasdfasdfasdfasdf)
|
188
|
+
|
189
|
+
|
190
|
+
--------
|
191
|
+
|
192
|
+
## Support
|
193
|
+
|
194
|
+
If you need help, you may consider:
|
195
|
+
|
196
|
+
1. Watching this [**video tutorial**](http://www.youtube.com/watch?v=Zo2vav3dYnY):
|
197
|
+
|
198
|
+
[![ExceptionHandler Update](http://img.youtube.com/vi/Zo2vav3dYnY/0.jpg)](http://www.youtube.com/watch?v=Zo2vav3dYnY)
|
199
|
+
2. Read [**our tutorial**](http://google.com)
|
200
|
+
3. Ask on [**StackOverflow**](http://stackoverflow.com)
|
201
|
+
4. Go on the [**gem support page**](http://frontlineutilities.co.uk)
|
202
|
+
|
203
|
+
---------
|
204
|
+
|
205
|
+
## Contributing
|
206
|
+
|
207
|
+
1. Fork it ( https://github.com/richpeck/exception_handler/fork )
|
208
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
209
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
210
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
211
|
+
5. Create a new Pull Request
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ExceptionHandler
|
2
|
-
class ExceptionController <
|
2
|
+
class ExceptionController < ActionController::Base
|
3
3
|
|
4
4
|
#Response
|
5
5
|
respond_to :html, :xml, :json
|
@@ -51,7 +51,7 @@ module ExceptionHandler
|
|
51
51
|
|
52
52
|
#Layout
|
53
53
|
def layout_status
|
54
|
-
|
54
|
+
@status.to_s != "404" ? "error" : "application"
|
55
55
|
end
|
56
56
|
|
57
57
|
#App
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% if @status.to_s == "404" %>
|
2
|
+
|
3
|
+
Sorry, this page is missing!
|
4
|
+
|
5
|
+
<% else %>
|
6
|
+
|
7
|
+
<div class="error">
|
8
|
+
|
9
|
+
<!--Alert -->
|
10
|
+
<%= image_tag 'exception_handler/alert.png', width: "150", alt: "Error!", title: "Sorry, A Server Error Occurred", class: "alert" %>
|
11
|
+
|
12
|
+
<!--Message -->
|
13
|
+
<div class="message">
|
14
|
+
<strong><%= details[:name] %></strong>
|
15
|
+
<span><%= details[:message] %></span>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<!--Contact -->
|
19
|
+
<div class="contact">
|
20
|
+
<% ExceptionHandler.config.social.each do |item, address| %>
|
21
|
+
<%= link_to image_tag("exception_handler/contact/#{item}.png", title: item.to_s.titleize), address, target: :blank %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<% end %>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<!--Info -->
|
6
|
+
<title>
|
7
|
+
<%= "Error :: #{@app_name}" %>
|
8
|
+
</title>
|
9
|
+
|
10
|
+
<!--Styling -->
|
11
|
+
<style>
|
12
|
+
|
13
|
+
html {
|
14
|
+
height: 100%;
|
15
|
+
background: #fff asset_url("custom_error_pages/bg.png") bottom repeat-x;
|
16
|
+
}
|
17
|
+
|
18
|
+
body {
|
19
|
+
font-family: Helvetica, Arial, Sans-Serif;
|
20
|
+
font-size: 14px;
|
21
|
+
}
|
22
|
+
.error_container {
|
23
|
+
display: block;
|
24
|
+
margin: auto;
|
25
|
+
margin: 10% auto 0 auto;
|
26
|
+
width: 30%;
|
27
|
+
}
|
28
|
+
|
29
|
+
.error_container .error {
|
30
|
+
display: block;
|
31
|
+
text-align: center;
|
32
|
+
}
|
33
|
+
|
34
|
+
.error_container .error img.icon {
|
35
|
+
display: block;
|
36
|
+
margin: 0 auto 25px auto;
|
37
|
+
}
|
38
|
+
|
39
|
+
.error_container .message > * {
|
40
|
+
display: block;
|
41
|
+
}
|
42
|
+
|
43
|
+
.error_container .message strong {
|
44
|
+
font-weight: bold;
|
45
|
+
font-size: 1.5em;
|
46
|
+
color: #f00;
|
47
|
+
margin: 15px 0 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
.error_container .message span {
|
51
|
+
margin: 5px auto 0;
|
52
|
+
font-size: 0.75em;
|
53
|
+
color: #606060;
|
54
|
+
}
|
55
|
+
|
56
|
+
.error_container .contact {
|
57
|
+
display: block;
|
58
|
+
text-align: center;
|
59
|
+
margin: 20px 0 0 0;
|
60
|
+
}
|
61
|
+
|
62
|
+
.error_container .contact a {
|
63
|
+
display: inline-block;
|
64
|
+
margin: 0 -1px; /* For inline block & ERB - HAML removes whitespace; ERB does now - http://haml.info/docs/yardoc/file.REFERENCE.html#whitespace_removal__and_ */
|
65
|
+
opacity: 0.4;
|
66
|
+
transition: opacity 0.15s ease;
|
67
|
+
}
|
68
|
+
|
69
|
+
.error_container .contact a:hover {
|
70
|
+
opacity: 0.8;
|
71
|
+
}
|
72
|
+
|
73
|
+
</style>
|
74
|
+
</head>
|
75
|
+
|
76
|
+
<!--Body -->
|
77
|
+
<body>
|
78
|
+
<div class="error_container">
|
79
|
+
<%= yield %>
|
80
|
+
</div>
|
81
|
+
</body>
|
82
|
+
|
83
|
+
</html>
|
data/exception_handler.gemspec
CHANGED
@@ -1,29 +1,27 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'exception_handler/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "exception_handler"
|
8
|
-
spec.version = ExceptionHandler::VERSION
|
9
|
-
spec.authors = ["Richard Peck", "Joe Hilton"]
|
10
|
-
spec.email = ["rpeck@frontlineutilities.co.uk", "jhilton@frontlineutilities.co.uk"]
|
11
|
-
spec.summary = %q{Rails gem to show custom error pages in production. Also logs errors in "errors" db if required}
|
12
|
-
spec.description = %q{Rails gem to create custom error pages. Captures exceptions using "exception_app" callback, routing to "Exception" controller, rendering the view as required.}
|
13
|
-
spec.homepage = "http://frontlineutilities.co.uk/ror/custom_error_pages"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
-
spec.add_development_dependency "rails", "~> 4.0.0"
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "rake"
|
28
|
-
spec.add_development_dependency "rspec"
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'exception_handler/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "exception_handler"
|
8
|
+
spec.version = ExceptionHandler::VERSION
|
9
|
+
spec.authors = ["Richard Peck", "Joe Hilton"]
|
10
|
+
spec.email = ["rpeck@frontlineutilities.co.uk", "jhilton@frontlineutilities.co.uk"]
|
11
|
+
spec.summary = %q{Rails gem to show custom error pages in production. Also logs errors in "errors" db if required}
|
12
|
+
spec.description = %q{Rails gem to create custom error pages. Captures exceptions using "exception_app" callback, routing to "Exception" controller, rendering the view as required.}
|
13
|
+
spec.homepage = "http://frontlineutilities.co.uk/ror/custom_error_pages"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rails", "~> 4.0.0"
|
23
|
+
spec.add_development_dependency "activerecord"
|
24
|
+
spec.add_development_dependency "activesupport"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
29
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Peck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -39,34 +39,6 @@ dependencies:
|
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 4.0.0
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: haml
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ~>
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 4.0.5
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 4.0.5
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: sass
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 3.3.7
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 3.3.7
|
70
42
|
- !ruby/object:Gem::Dependency
|
71
43
|
name: activerecord
|
72
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,8 +120,8 @@ files:
|
|
148
120
|
- app/assets/images/exception_handler/contact/youtube.png
|
149
121
|
- app/controllers/exception_handler/exception_controller.rb
|
150
122
|
- app/models/exception_handler/error.rb
|
151
|
-
- app/views/exception_handler/exception/show.html.
|
152
|
-
- app/views/layouts/error.html.
|
123
|
+
- app/views/exception_handler/exception/show.html.erb
|
124
|
+
- app/views/layouts/error.html.erb
|
153
125
|
- exception_handler.gemspec
|
154
126
|
- lib/exception_handler.rb
|
155
127
|
- lib/exception_handler/config.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
- if @status.to_s == "404"
|
2
|
-
Sorry, this page is missing!
|
3
|
-
- else
|
4
|
-
.error
|
5
|
-
/Alert
|
6
|
-
= image_tag 'exception_handler/alert.png', width: "150", alt: "Error!", title: "Sorry, A Server Error Occurred", class: "alert"
|
7
|
-
|
8
|
-
/Message
|
9
|
-
.message
|
10
|
-
%strong
|
11
|
-
= details[:name]
|
12
|
-
%span
|
13
|
-
= details[:message]
|
14
|
-
|
15
|
-
/Contact
|
16
|
-
.contact
|
17
|
-
- ExceptionHandler.config.social.each do |item, address|
|
18
|
-
%a{ href: address, target: "_blank" }> #{image_tag "exception_handler/contact/#{item}.png", title: item.to_s.titleize}
|
@@ -1,67 +0,0 @@
|
|
1
|
-
!!!
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
|
5
|
-
/Info
|
6
|
-
%title
|
7
|
-
= "Error :: #{@app_name}"
|
8
|
-
|
9
|
-
/Styling
|
10
|
-
:sass
|
11
|
-
html
|
12
|
-
height: 100%
|
13
|
-
background: #fff url(#{image_path "custom_error_pages/bg.png"}) bottom repeat-x
|
14
|
-
|
15
|
-
body
|
16
|
-
font-family: Helvetica, Arial, Sans-Serif
|
17
|
-
font-size: 14px
|
18
|
-
|
19
|
-
.error_container
|
20
|
-
display: block
|
21
|
-
margin: auto
|
22
|
-
margin: 10% auto 0 auto
|
23
|
-
width: 30%
|
24
|
-
|
25
|
-
.error_container .error
|
26
|
-
display: block
|
27
|
-
text-align: center
|
28
|
-
|
29
|
-
.error_container .error img.icon
|
30
|
-
display: block
|
31
|
-
margin: 0 auto 25px auto
|
32
|
-
|
33
|
-
.error_container .message > *
|
34
|
-
display: block
|
35
|
-
|
36
|
-
.error_container .message strong
|
37
|
-
font:
|
38
|
-
weight: bold
|
39
|
-
size: 1.5em
|
40
|
-
color: #f00
|
41
|
-
margin: 15px 0 0
|
42
|
-
|
43
|
-
.error_container .message span
|
44
|
-
margin: 5px auto 0
|
45
|
-
font:
|
46
|
-
size: 0.75em
|
47
|
-
color: #606060
|
48
|
-
|
49
|
-
.error_container .contact
|
50
|
-
display: block
|
51
|
-
text-align: center
|
52
|
-
margin: 20px 0 0 0
|
53
|
-
|
54
|
-
.error_container .contact a
|
55
|
-
display: inline-block
|
56
|
-
margin: 0 1px
|
57
|
-
opacity: 0.4
|
58
|
-
transition: opacity 0.15s ease
|
59
|
-
|
60
|
-
.error_container .contact a:hover
|
61
|
-
opacity: 0.8
|
62
|
-
|
63
|
-
|
64
|
-
/Body
|
65
|
-
%body
|
66
|
-
.error_container
|
67
|
-
= yield
|