exception_handler 0.3.5 → 0.3.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/exception_handler/exception_controller.rb +3 -4
- data/app/views/exception_handler/exception/show.html.erb +3 -1
- data/app/views/layouts/error.html.erb +9 -8
- data/lib/exception_handler.rb +7 -10
- data/lib/exception_handler/config.rb +2 -4
- data/lib/exception_handler/version.rb +1 -1
- data/lib/generators/exception_handler/install_generator.rb +1 -1
- data/lib/generators/exception_handler/migration_generator.rb +2 -12
- data/lib/generators/templates/{migration.rb.erb → create_table.rb} +2 -2
- data/lib/generators/templates/exception_handler.rb +25 -0
- data/readme/exception_handler.png +0 -0
- metadata +23 -24
- data/lib/generators/templates/config.rb +0 -21
- data/readme/source/title.psd +0 -0
- data/readme/title.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254750bbbe4a146b769a20057fd8bcf62b3aaeaa
|
4
|
+
data.tar.gz: be5674f4da113a7902566445fbec37edd0242fcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d1117bcbe2e45a4981ee5bdce1988b008e0e19c29aa70800c5cf00971f42b5a15f2e47aad793ccb8b0a67c6cbe0b665b8a46dd65b611eed96adc55c8aa0b4af
|
7
|
+
data.tar.gz: d876bc69394ef3ca176a5903ba654294cf1d8c6123f0e5139f240eb97e94f70bb6bb82d90b260b7593448e8a3696dd3d20442bd42696a50603a42b68b2bf4bdd
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [![Exception Handler](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/
|
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
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/exception_handler.svg)](http://badge.fury.io/rb/exception_handler)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/richpeck/exception_handler.png)](https://codeclimate.com/github/richpeck/exception_handler)
|
@@ -16,7 +16,7 @@ module ExceptionHandler
|
|
16
16
|
|
17
17
|
#Show
|
18
18
|
def show
|
19
|
-
|
19
|
+
respond_with status: @status
|
20
20
|
end
|
21
21
|
|
22
22
|
####################
|
@@ -51,8 +51,7 @@ module ExceptionHandler
|
|
51
51
|
|
52
52
|
#Layout
|
53
53
|
def layout_status
|
54
|
-
|
55
|
-
ExceptionHandler.config.error_layout || 'application'
|
54
|
+
@status.to_s != "404" ? "error" : "application"
|
56
55
|
end
|
57
56
|
|
58
57
|
#App
|
@@ -61,4 +60,4 @@ module ExceptionHandler
|
|
61
60
|
end
|
62
61
|
|
63
62
|
end
|
64
|
-
end
|
63
|
+
end
|
@@ -7,7 +7,9 @@
|
|
7
7
|
<div class="error">
|
8
8
|
|
9
9
|
<!--Alert -->
|
10
|
-
|
10
|
+
<div class="alert">
|
11
|
+
<%= image_tag 'exception_handler/alert.png', width: "150", alt: "Error!", title: "Sorry, A Server Error Occurred" %>
|
12
|
+
</div>
|
11
13
|
|
12
14
|
<!--Message -->
|
13
15
|
<div class="message">
|
@@ -3,7 +3,9 @@
|
|
3
3
|
<head>
|
4
4
|
|
5
5
|
<!--Info -->
|
6
|
-
<title
|
6
|
+
<title>
|
7
|
+
Error
|
8
|
+
</title>
|
7
9
|
|
8
10
|
<!--Styling -->
|
9
11
|
<style>
|
@@ -29,10 +31,15 @@
|
|
29
31
|
text-align: center;
|
30
32
|
}
|
31
33
|
|
32
|
-
.error_container .error
|
34
|
+
.error_container .error .alert {
|
33
35
|
display: block;
|
34
36
|
margin: 0 auto 25px auto;
|
35
37
|
}
|
38
|
+
|
39
|
+
.error_container .error .alert img {
|
40
|
+
display: block;
|
41
|
+
margin: 0 auto;
|
42
|
+
}
|
36
43
|
|
37
44
|
.error_container .message > * {
|
38
45
|
display: block;
|
@@ -63,12 +70,6 @@
|
|
63
70
|
opacity: 0.4;
|
64
71
|
transition: opacity 0.15s ease;
|
65
72
|
}
|
66
|
-
|
67
|
-
.error_container .contact a img {
|
68
|
-
display: block;
|
69
|
-
width: 38px;
|
70
|
-
height: 38px;
|
71
|
-
}
|
72
73
|
|
73
74
|
.error_container .contact a:hover {
|
74
75
|
opacity: 0.8;
|
data/lib/exception_handler.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
require "action_dispatch"
|
5
5
|
|
6
6
|
#Gem Files
|
7
|
-
|
8
|
-
for
|
9
|
-
require "exception_handler/#{
|
7
|
+
versions = %w(version parser config)
|
8
|
+
for version in versions do
|
9
|
+
require "exception_handler/#{version}"
|
10
10
|
end
|
11
11
|
|
12
12
|
###########################################
|
@@ -25,17 +25,14 @@ module ExceptionHandler
|
|
25
25
|
# Config #
|
26
26
|
####################
|
27
27
|
|
28
|
-
|
28
|
+
#Ref http://robots.thoughtbot.com/mygem-configure-block
|
29
|
+
mattr_accessor :config, :table
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
mattr_accessor :config
|
33
|
-
|
34
|
-
end
|
31
|
+
#Vars
|
32
|
+
@@config ||= Config.new
|
35
33
|
|
36
34
|
#Block (for initializer)
|
37
35
|
def self.setup
|
38
|
-
self.config ||= Config.new
|
39
36
|
yield(config) if block_given?
|
40
37
|
end
|
41
38
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
module ExceptionHandler
|
10
10
|
class Config
|
11
|
-
attr_accessor :db, :social
|
11
|
+
attr_accessor :db, :social
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@db = false # -> db name (false = no; true = "errors"; [value] = [value])
|
@@ -19,8 +19,6 @@ module ExceptionHandler
|
|
19
19
|
youtube: "https://youtube.com/user/frontlineutils",
|
20
20
|
fusion: "http://frontlinefusion.com/frontlineutils"
|
21
21
|
}
|
22
|
-
@error_layout = nil
|
23
|
-
@exception_layout = nil
|
24
22
|
end
|
25
23
|
end
|
26
|
-
end
|
24
|
+
end
|
@@ -10,7 +10,7 @@ module ExceptionHandler
|
|
10
10
|
#Config
|
11
11
|
def create_config_file
|
12
12
|
return unless options.empty?
|
13
|
-
template "
|
13
|
+
template "exception_handler.rb", "config/initializers/exception_handler.rb" # https://github.com/plataformatec/devise/blob/master/lib/generators/devise/install_generator.rb#L13
|
14
14
|
end
|
15
15
|
|
16
16
|
###########################################
|
@@ -18,20 +18,10 @@ module ExceptionHandler
|
|
18
18
|
|
19
19
|
###########################################
|
20
20
|
|
21
|
-
#
|
22
|
-
#Always outputs string for some reason...
|
23
|
-
def table_name
|
24
|
-
ExceptionHandler.config.db || :errors
|
25
|
-
end
|
26
|
-
|
27
|
-
###########################################
|
28
|
-
|
29
|
-
#Create
|
21
|
+
#Create Migration
|
30
22
|
def create_errors_migration
|
31
|
-
migration_template "
|
23
|
+
migration_template "create_table.rb", "db/migrate/create_errors.rb"
|
32
24
|
end
|
33
25
|
|
34
|
-
###########################################
|
35
|
-
|
36
26
|
end
|
37
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateErrors < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table
|
3
|
+
create_table :errors do |t|
|
4
4
|
t.string :usable_type
|
5
5
|
t.integer :usable_id
|
6
6
|
t.text :class_name
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#Exception Handler
|
2
|
+
###
|
3
|
+
#You can add different settings using this block
|
4
|
+
#Use the docs at http://github.com/richpeck/exception_handler for info
|
5
|
+
###
|
6
|
+
ExceptionHandler.setup do |config|
|
7
|
+
|
8
|
+
#DB -
|
9
|
+
#Options = false / true
|
10
|
+
config.db = false
|
11
|
+
|
12
|
+
#Email -
|
13
|
+
#Default = false / true
|
14
|
+
#config.email =
|
15
|
+
|
16
|
+
#Social
|
17
|
+
config.social = {
|
18
|
+
twitter: "http://twitter.com/frontlineutils",
|
19
|
+
facebook: "https://facebook.com/frontline.utilities",
|
20
|
+
linkedin: "https://linkedin.com/company/frontline-utilities",
|
21
|
+
youtube: "https://youtube.com/user/frontlineutils",
|
22
|
+
fusion: "http://frontlinefusion.com/frontlineutils"
|
23
|
+
}
|
24
|
+
|
25
|
+
end
|
Binary file
|
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.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Peck
|
@@ -9,90 +9,90 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.6'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.6'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rails
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 4.0.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 4.0.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: activerecord
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: activesupport
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rake
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rspec
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '>='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
description: Rails gem to create custom error pages. Captures exceptions using "exception_app"
|
@@ -104,9 +104,9 @@ executables: []
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
107
|
+
- .gitignore
|
108
|
+
- .rspec
|
109
|
+
- .travis.yml
|
110
110
|
- Gemfile
|
111
111
|
- LICENSE.txt
|
112
112
|
- README.md
|
@@ -130,8 +130,8 @@ files:
|
|
130
130
|
- lib/generators/exception_handler/install_generator.rb
|
131
131
|
- lib/generators/exception_handler/migration_generator.rb
|
132
132
|
- lib/generators/exception_handler/views_generator.rb
|
133
|
-
- lib/generators/templates/
|
134
|
-
- lib/generators/templates/
|
133
|
+
- lib/generators/templates/create_table.rb
|
134
|
+
- lib/generators/templates/exception_handler.rb
|
135
135
|
- readme/404.png
|
136
136
|
- readme/404_demo.png
|
137
137
|
- readme/500.png
|
@@ -140,12 +140,11 @@ files:
|
|
140
140
|
- readme/config_db.png
|
141
141
|
- readme/db.png
|
142
142
|
- readme/development.png
|
143
|
+
- readme/exception_handler.png
|
143
144
|
- readme/gem_install.png
|
144
145
|
- readme/install.png
|
145
146
|
- readme/install_migration.png
|
146
147
|
- readme/install_views.png
|
147
|
-
- readme/source/title.psd
|
148
|
-
- readme/title.png
|
149
148
|
- spec/installation_spec.rb
|
150
149
|
- spec/spec_helper.rb
|
151
150
|
homepage: http://frontlineutilities.co.uk/ror/custom_error_pages
|
@@ -158,17 +157,17 @@ require_paths:
|
|
158
157
|
- lib
|
159
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
160
159
|
requirements:
|
161
|
-
- -
|
160
|
+
- - '>='
|
162
161
|
- !ruby/object:Gem::Version
|
163
162
|
version: '0'
|
164
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
164
|
requirements:
|
166
|
-
- -
|
165
|
+
- - '>='
|
167
166
|
- !ruby/object:Gem::Version
|
168
167
|
version: '0'
|
169
168
|
requirements: []
|
170
169
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.0.14
|
172
171
|
signing_key:
|
173
172
|
specification_version: 4
|
174
173
|
summary: Rails gem to show custom error pages in production. Also logs errors in "errors"
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Exception Handler
|
2
|
-
###
|
3
|
-
# You can add different settings using this block
|
4
|
-
# Use the docs at http://github.com/richpeck/exception_handler for info
|
5
|
-
###
|
6
|
-
ExceptionHandler.setup do |config|
|
7
|
-
# DB -
|
8
|
-
# Options = false / true
|
9
|
-
config.db = false
|
10
|
-
# Email -
|
11
|
-
# Default = false / true
|
12
|
-
# config.email =
|
13
|
-
# Social
|
14
|
-
config.social = {
|
15
|
-
twitter: 'http://twitter.com/frontlineutils',
|
16
|
-
facebook: 'https://facebook.com/frontline.utilities',
|
17
|
-
linkedin: 'https://linkedin.com/company/frontline-utilities',
|
18
|
-
youtube: 'https://youtube.com/user/frontlineutils',
|
19
|
-
fusion: 'http://frontlinefusion.com/frontlineutils'
|
20
|
-
}
|
21
|
-
end
|
data/readme/source/title.psd
DELETED
Binary file
|
data/readme/title.png
DELETED
Binary file
|