ixtlan-error-handler 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,7 +49,7 @@ module Ixtlan
49
49
 
50
50
  def initialize( model = nil, &block )
51
51
  @model = model
52
- @keep_dumps = 30
52
+ @keep_dumps = 0
53
53
  block.call( self ) if block
54
54
  @block = block
55
55
  end
@@ -48,7 +48,6 @@ module Ixtlan
48
48
  def initialize(app, dumper, map = {} )
49
49
  @app = app
50
50
  @dumper = dumper
51
- @dump_to_console = dumper.keep_dumps == 0
52
51
  @map = {}
53
52
  DEFAULT_MAP.each do |status, list|
54
53
  list.each { |exp| @map[ exp ] = status }
@@ -58,6 +57,10 @@ module Ixtlan
58
57
  end
59
58
  end
60
59
 
60
+ def dump_to_console
61
+ @dumper.keep_dumps == 0
62
+ end
63
+
61
64
  def call(env)
62
65
  begin
63
66
  @app.call(env)
@@ -67,13 +70,17 @@ module Ixtlan
67
70
  req = ::Rack::Request.new env
68
71
  @dumper.dump( e, env, {}, req.session, req.params )
69
72
  end
70
- if @dump_to_console
71
- warn "[Ixtlan::Errors] #{e.class}: #{e.message}"
73
+ warn "[Ixtlan::Errors] #{e.class}: #{e.message}"
74
+ if dump_to_console
75
+ # dump to console and raise exception to let rack create
76
+ # an error page
72
77
  warn "\t" + e.backtrace.join( "\n\t" ) if e.backtrace && status >= 500
73
- end
78
+ raise e
79
+ else
74
80
  [ status,
75
81
  {'Content-Type' => 'text/plain'},
76
82
  [ ::Rack::Utils::HTTP_STATUS_CODES[ status ] ] ]
83
+ end
77
84
  end
78
85
  end
79
86
 
data/spec/dumper_spec.rb CHANGED
@@ -46,6 +46,7 @@ describe Ixtlan::Errors::Dumper do
46
46
 
47
47
  before :each do
48
48
  @dumper = Ixtlan::Errors::Dumper.new
49
+ @dumper.send :instance_variable_set, '@keep_dumps'.to_sym, 1
49
50
  @dumper.model = Error
50
51
  @dumper.base_url = "http://localhost"
51
52
  @controller = Controller.new
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ixtlan-error-handler
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.4.4
4
5
  prerelease:
5
- version: 0.4.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Meier
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-11 00:00:00.000000000 Z
12
+ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slf4r
16
16
  version_requirements: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.4.2
21
21
  none: false
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.4.2
27
27
  none: false
@@ -31,13 +31,13 @@ dependencies:
31
31
  name: rspec
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ~>
35
35
  - !ruby/object:Gem::Version
36
36
  version: '2.11'
37
37
  none: false
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - "~>"
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
42
  version: '2.11'
43
43
  none: false
@@ -47,15 +47,15 @@ dependencies:
47
47
  name: rake
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - "~>"
50
+ - - ~>
51
51
  - !ruby/object:Gem::Version
52
- version: 10.0.2
52
+ version: '10.0'
53
53
  none: false
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - "~>"
56
+ - - ~>
57
57
  - !ruby/object:Gem::Version
58
- version: 10.0.2
58
+ version: '10.0'
59
59
  none: false
60
60
  prerelease: false
61
61
  type: :development
@@ -63,13 +63,13 @@ dependencies:
63
63
  name: dm-core
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.2.0
69
69
  none: false
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ~>
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.2.0
75
75
  none: false
@@ -79,13 +79,13 @@ dependencies:
79
79
  name: dm-migrations
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - "~>"
82
+ - - ~>
83
83
  - !ruby/object:Gem::Version
84
84
  version: 1.2.0
85
85
  none: false
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ~>
89
89
  - !ruby/object:Gem::Version
90
90
  version: 1.2.0
91
91
  none: false
@@ -95,13 +95,13 @@ dependencies:
95
95
  name: dm-sqlite-adapter
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - "~>"
98
+ - - ~>
99
99
  - !ruby/object:Gem::Version
100
100
  version: 1.2.0
101
101
  none: false
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - "~>"
104
+ - - ~>
105
105
  - !ruby/object:Gem::Version
106
106
  version: 1.2.0
107
107
  none: false
@@ -111,13 +111,13 @@ dependencies:
111
111
  name: pony
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - "~>"
114
+ - - ~>
115
115
  - !ruby/object:Gem::Version
116
116
  version: '1.4'
117
117
  none: false
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - "~>"
120
+ - - ~>
121
121
  - !ruby/object:Gem::Version
122
122
  version: '1.4'
123
123
  none: false
@@ -133,54 +133,52 @@ files:
133
133
  - MIT-LICENSE
134
134
  - README.textile
135
135
  - lib/ixtlan-error-handler.rb
136
- - lib/ixtlan/errors/rescue_module.rb~
137
- - lib/ixtlan/errors/mailer.rb~
138
- - lib/ixtlan/errors/rack.rb
136
+ - lib/ixtlan/errors/error.rb~
139
137
  - lib/ixtlan/errors/resource.rb
138
+ - lib/ixtlan/errors/cuba.rb~
140
139
  - lib/ixtlan/errors/resource.rb~
141
- - lib/ixtlan/errors/rack.rb~
142
- - lib/ixtlan/errors/dumper.rb
143
- - lib/ixtlan/errors/railtie.rb
144
- - lib/ixtlan/errors/error_dumper.rb~
145
- - lib/ixtlan/errors/dumper.rb~
146
140
  - lib/ixtlan/errors/cuba.rb
147
141
  - lib/ixtlan/errors/error_serializer.rb~
148
- - lib/ixtlan/errors/railtie.rb~
142
+ - lib/ixtlan/errors/dumper.rb~
143
+ - lib/ixtlan/errors/railtie.rb
144
+ - lib/ixtlan/errors/error_handling.rb~
145
+ - lib/ixtlan/errors/dumper.rb
149
146
  - lib/ixtlan/errors/rescue_module.rb
150
- - lib/ixtlan/errors/serializer.rb
151
- - lib/ixtlan/errors/error.rb~
147
+ - lib/ixtlan/errors/error_dumper.rb~
148
+ - lib/ixtlan/errors/rack.rb~
152
149
  - lib/ixtlan/errors/error_handler.rb
153
- - lib/ixtlan/errors/mailer.rb
154
- - lib/ixtlan/errors/error_handling.rb~
150
+ - lib/ixtlan/errors/rescue_module.rb~
155
151
  - lib/ixtlan/errors/error_handler.rb~
156
- - lib/ixtlan/errors/cuba.rb~
152
+ - lib/ixtlan/errors/mailer.rb
153
+ - lib/ixtlan/errors/mailer.rb~
154
+ - lib/ixtlan/errors/serializer.rb
155
+ - lib/ixtlan/errors/railtie.rb~
156
+ - lib/ixtlan/errors/rack.rb
157
157
  - lib/ixtlan/errors/mailer/error_notification.erb
158
- - spec/error_dumper_spec.rb~
158
+ - spec/error_handler_spec.rb~
159
159
  - spec/error_handler_spec.rb
160
160
  - spec/dumper_spec.rb
161
- - spec/error_handler_spec.rb~
161
+ - spec/error_dumper_spec.rb~
162
162
  homepage: http://github.com/mkristian/ixtlan-error-handler
163
163
  licenses:
164
164
  - MIT
165
165
  post_install_message:
166
166
  rdoc_options:
167
- - "--main"
167
+ - --main
168
168
  - README.textile
169
169
  require_paths:
170
170
  - lib
171
171
  required_ruby_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - ">="
173
+ - - '>='
174
174
  - !ruby/object:Gem::Version
175
- version: !binary |-
176
- MA==
175
+ version: '0'
177
176
  none: false
178
177
  required_rubygems_version: !ruby/object:Gem::Requirement
179
178
  requirements:
180
- - - ">="
179
+ - - '>='
181
180
  - !ruby/object:Gem::Version
182
- version: !binary |-
183
- MA==
181
+ version: '0'
184
182
  none: false
185
183
  requirements: []
186
184
  rubyforge_project: