goalie 0.0.3 → 0.0.4
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.
- data/README.md +9 -4
- data/Rakefile +2 -0
- data/app/controllers/local_errors_controller.rb +1 -10
- data/goalie.gemspec +9 -2
- data/lib/goalie.rb +2 -0
- data/lib/goalie/error_details.rb +22 -0
- data/lib/goalie/rails.rb +1 -1
- data/lib/goalie/version.rb +1 -1
- metadata +38 -6
data/README.md
CHANGED
@@ -55,9 +55,10 @@ you can redirect them to others, for example, with:
|
|
55
55
|
|
56
56
|
You can also customize only the views and use Goalie's default
|
57
57
|
controller. All you need is to have inside `app/views/public_errors`
|
58
|
-
views with the same names as the actions listed above.
|
59
|
-
|
60
|
-
|
58
|
+
views with the same names as the actions listed above.
|
59
|
+
|
60
|
+
Besides the standard stuff that Rails makes available to views, you will also have
|
61
|
+
access to the following instance variables if you include the Goalie::ErrorDetails module:
|
61
62
|
|
62
63
|
* `@request`
|
63
64
|
* `@exception`
|
@@ -69,7 +70,11 @@ Be VERY careful when using this in production, as you could expose
|
|
69
70
|
sensitive information inside the request and exception. Generally, you
|
70
71
|
probably shouldn't use these variables at all. The only place it makes
|
71
72
|
sense is to have a more detailed error screen for admins or other
|
72
|
-
high-level users.
|
73
|
+
high-level users. By default these details are not available to the public errors views
|
74
|
+
but can be made available if you override the `PublicErrorsController` and
|
75
|
+
include the Goalie::ErrorDetails module.
|
76
|
+
|
77
|
+
|
73
78
|
|
74
79
|
## Credit
|
75
80
|
|
data/Rakefile
CHANGED
@@ -15,6 +15,8 @@ begin
|
|
15
15
|
gemspec.email = "helder@gmail.com"
|
16
16
|
gemspec.homepage = "http://github.com/obvio171/goalie"
|
17
17
|
gemspec.authors = ["Helder Ribeiro"]
|
18
|
+
gemspec.add_dependency 'actionpack', '>= 3.0.0'
|
19
|
+
gemspec.add_dependency 'activesupport', '>= 3.0.0'
|
18
20
|
end
|
19
21
|
|
20
22
|
Jeweler::GemcutterTasks.new
|
@@ -1,6 +1,5 @@
|
|
1
1
|
class LocalErrorsController < ActionController::Base
|
2
|
-
|
3
|
-
before_filter :set_error_instance_variables
|
2
|
+
include Goalie::ErrorDetails
|
4
3
|
|
5
4
|
def routing_error
|
6
5
|
end
|
@@ -17,13 +16,5 @@ class LocalErrorsController < ActionController::Base
|
|
17
16
|
def diagnostics
|
18
17
|
end
|
19
18
|
|
20
|
-
private
|
21
|
-
def set_error_instance_variables
|
22
|
-
error_params = env['goalie.error_params']
|
23
|
-
|
24
|
-
error_params.each do |name, value|
|
25
|
-
instance_variable_set("@#{name}", value)
|
26
|
-
end
|
27
|
-
end
|
28
19
|
|
29
20
|
end
|
data/goalie.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{goalie}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Helder Ribeiro"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-20}
|
13
13
|
s.description = %q{Middleware to catch exceptions and Rails Engine to render them. Error-handling views and controllers can be easily overriden.}
|
14
14
|
s.email = %q{helder@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"app/views/public_errors/unprocessable_entity.html",
|
36
36
|
"goalie.gemspec",
|
37
37
|
"lib/goalie.rb",
|
38
|
+
"lib/goalie/error_details.rb",
|
38
39
|
"lib/goalie/exceptions.rb",
|
39
40
|
"lib/goalie/rails.rb",
|
40
41
|
"lib/goalie/version.rb",
|
@@ -55,9 +56,15 @@ Gem::Specification.new do |s|
|
|
55
56
|
s.specification_version = 3
|
56
57
|
|
57
58
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_runtime_dependency(%q<actionpack>, [">= 3.0.0"])
|
60
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
58
61
|
else
|
62
|
+
s.add_dependency(%q<actionpack>, [">= 3.0.0"])
|
63
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
59
64
|
end
|
60
65
|
else
|
66
|
+
s.add_dependency(%q<actionpack>, [">= 3.0.0"])
|
67
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
data/lib/goalie.rb
CHANGED
@@ -5,6 +5,8 @@ require 'action_dispatch/http/request'
|
|
5
5
|
require 'goalie/exceptions'
|
6
6
|
|
7
7
|
module Goalie
|
8
|
+
autoload :ErrorDetails, "goalie/error_details"
|
9
|
+
|
8
10
|
# This middleware rescues any exception returned by the application
|
9
11
|
# and renders nice exception pages.
|
10
12
|
class CustomErrorPages
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Goalie
|
4
|
+
module ErrorDetails
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
before_filter :set_error_instance_variables
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def set_error_instance_variables
|
14
|
+
error_params = env['goalie.error_params']
|
15
|
+
|
16
|
+
error_params.each do |name, value|
|
17
|
+
instance_variable_set("@#{name}", value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/goalie/rails.rb
CHANGED
@@ -2,7 +2,7 @@ module Goalie
|
|
2
2
|
class Engine < Rails::Engine
|
3
3
|
|
4
4
|
initializer "goalie.add_middleware" do |app|
|
5
|
-
app.middleware.insert_after 'ActionDispatch::RemoteIp', Goalie::CustomErrorPages
|
5
|
+
app.middleware.insert_after 'ActionDispatch::RemoteIp', Goalie::CustomErrorPages, app.config.consider_all_requests_local
|
6
6
|
app.middleware.delete 'ActionDispatch::ShowExceptions'
|
7
7
|
end
|
8
8
|
|
data/lib/goalie/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goalie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Helder Ribeiro
|
@@ -15,10 +15,41 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-20 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: actionpack
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 3.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activesupport
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 3.0.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
22
53
|
description: Middleware to catch exceptions and Rails Engine to render them. Error-handling views and controllers can be easily overriden.
|
23
54
|
email: helder@gmail.com
|
24
55
|
executables: []
|
@@ -47,6 +78,7 @@ files:
|
|
47
78
|
- app/views/public_errors/unprocessable_entity.html
|
48
79
|
- goalie.gemspec
|
49
80
|
- lib/goalie.rb
|
81
|
+
- lib/goalie/error_details.rb
|
50
82
|
- lib/goalie/exceptions.rb
|
51
83
|
- lib/goalie/rails.rb
|
52
84
|
- lib/goalie/version.rb
|