hoptoad_notifier 2.4.8 → 2.4.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ Version 2.4.9 - Wed Mar 30 09:04:53 -0400 2011
2
+ ===============================================================================
3
+
4
+ Jonathan Yurek(1):
5
+ The User Informer should adhere to only the Rack spec.
6
+
1
7
  Version 2.4.8 - Mon Mar 21 11:11:16 -0400 2011
2
8
  ===============================================================================
3
9
 
@@ -423,5 +429,6 @@ Nick Quaranto (3):
423
429
 
424
430
 
425
431
 
432
+
426
433
 
427
434
 
data/README.md CHANGED
@@ -228,6 +228,26 @@ To perform custom error processing after Hoptoad has been notified, define the
228
228
  instance method #rescue_action_in_public_without_hoptoad(exception) in your
229
229
  controller.
230
230
 
231
+ Informing the User
232
+ ------------------
233
+
234
+ The Notifier gem is capable of telling the user information about the error that just happened
235
+ via the user_information option. They can give this error number in bug resports, for example.
236
+ By default, if your 500.html contains the text
237
+
238
+ <!-- HOPTOAD ERROR -->
239
+
240
+ then that comment will be replaced with the text "Hoptoad Error [errnum]". You can modify the text
241
+ of the informer by setting config.user_information. The Notifier will replace "{{ error_id }}" with the
242
+ ID of the error that is returned from Hoptoad.
243
+
244
+ HoptoadNotifier.configure do |config|
245
+ ...
246
+ config.user_information = "<p>Tell the devs that it was <strong>{{ error_id }}</strong>'s fault.</p>"
247
+ end
248
+
249
+ You can also turn the middleware completely off by setting config.user_information to false.
250
+
231
251
  Tracking deployments in Hoptoad
232
252
  -------------------------------
233
253
 
@@ -10,11 +10,13 @@ module HoptoadNotifier
10
10
 
11
11
  def call(env)
12
12
  status, headers, body = @app.call(env)
13
- if env['hoptoad.error_id']
14
- body.each_with_index do |chunk, i|
15
- body[i] = chunk.to_s.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
13
+ if env['hoptoad.error_id'] && HoptoadNotifier.configuration.user_information
14
+ new_body = []
15
+ body.each do |chunk|
16
+ new_body << chunk.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
16
17
  end
17
- headers['Content-Length'] = body.sum(&:length).to_s
18
+ headers['Content-Length'] = new_body.sum(&:length).to_s
19
+ body = new_body
18
20
  end
19
21
  [status, headers, body]
20
22
  end
@@ -1,3 +1,3 @@
1
1
  module HoptoadNotifier
2
- VERSION = "2.4.8".freeze
2
+ VERSION = "2.4.9".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoptoad_notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 8
10
- version: 2.4.8
9
+ - 9
10
+ version: 2.4.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-21 00:00:00 -04:00
18
+ date: 2011-03-30 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency