chatterbox 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +7 -0
- data/README.markdown +10 -18
- data/{version.yml → VERSION.yml} +1 -1
- data/chatterbox.gemspec +2 -2
- data/examples/lib/chatterbox/rails_catcher_example.rb +0 -7
- data/lib/chatterbox/rails_catcher.rb +5 -11
- metadata +2 -2
data/CHANGELOG.markdown
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
HEAD
|
2
|
+
|
3
|
+
0.5.4
|
4
|
+
- Remove very dangerous delegation from RailsCatcher, as these delegates can override common
|
5
|
+
ActionController::Base methods when the catcher is included. Wishing Ruby had real namespaces
|
6
|
+
right about now
|
7
|
+
- Remove #log_prefix from RailsCatcher, simpler and not needed
|
8
|
+
|
2
9
|
0.5.3
|
3
10
|
- exception filtering
|
4
11
|
|
data/README.markdown
CHANGED
@@ -19,21 +19,23 @@ Then run:
|
|
19
19
|
|
20
20
|
## Exception Notification
|
21
21
|
|
22
|
-
One of the
|
22
|
+
One of the most handy use cases Chatterbox was developed for was Rails exception notification. To setup Chatterbox for exception notification, install it as a gem with the instructions above, then configure it inside an initializer:
|
23
23
|
|
24
|
-
|
24
|
+
Chatterbox::Services::Email.configure :to => "errors@example.com", :from => "donotreply@example.com"
|
25
|
+
|
26
|
+
Chatterbox::Publishers.register do |notification|
|
27
|
+
Chatterbox::Services::Email.deliver(notification)
|
28
|
+
end
|
25
29
|
|
26
|
-
|
30
|
+
then wire the `RailsCatcher` in your `ApplicationController`:
|
27
31
|
|
28
32
|
class ApplicationController < ActionController::Base
|
29
33
|
include Chatterbox::RailsCatcher
|
30
|
-
# ...
|
31
34
|
end
|
32
|
-
|
33
|
-
Then, wire up a producer
|
34
35
|
|
36
|
+
And you are done! Exceptions thrown in controllers will automatically be processed and sent by Chatterbox, and then raised to be handled (or not handled) as normally.
|
35
37
|
|
36
|
-
Example
|
38
|
+
## Example: Sending Emails
|
37
39
|
---------------------------------------
|
38
40
|
|
39
41
|
Register the email service to handle messages that get sent to Chatterbox:
|
@@ -46,20 +48,10 @@ Then, wherever you want to send email, do this:
|
|
46
48
|
|
47
49
|
message = {
|
48
50
|
:config => { :to => "joe@example.com", :from => "donotreply@example.com" },
|
49
|
-
:message => { :summary => "your subject line here" }
|
51
|
+
:message => { :summary => "your subject line here", :body => "Email body here" }
|
50
52
|
}
|
51
53
|
Chatterbox.handle_notice(options)
|
52
54
|
|
53
|
-
Example 2
|
54
|
-
---------------------------------------
|
55
|
-
|
56
|
-
Wiring up notices to be sent to an exceptions queue, defined in RosettaQueue
|
57
|
-
|
58
|
-
Chatterbox::Publishers.register do |notice|
|
59
|
-
RosettaQueue::Producer.publish(:exceptions, notice)
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
55
|
Bugs & Patches
|
64
56
|
--------------
|
65
57
|
|
data/{version.yml → VERSION.yml}
RENAMED
data/chatterbox.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chatterbox}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rob Sanheim"]
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"LICENSE",
|
24
24
|
"README.markdown",
|
25
25
|
"Rakefile",
|
26
|
+
"VERSION.yml",
|
26
27
|
"chatterbox.gemspec",
|
27
28
|
"examples/example_helper.rb",
|
28
29
|
"examples/lib/chatterbox/exception_notification/extracter_example.rb",
|
@@ -47,7 +48,6 @@ Gem::Specification.new do |s|
|
|
47
48
|
"lib/chatterbox/services/email/views/chatterbox/services/email/mailer/message.erb",
|
48
49
|
"rails/init.rb",
|
49
50
|
"todo.markdown",
|
50
|
-
"version.yml",
|
51
51
|
"views/chatterbox/mailer/exception_notification.erb"
|
52
52
|
]
|
53
53
|
s.homepage = %q{http://github.com/rsanheim/chatterbox}
|
@@ -10,13 +10,6 @@ describe Chatterbox::RailsCatcher do
|
|
10
10
|
}.new
|
11
11
|
end
|
12
12
|
|
13
|
-
describe "logger" do
|
14
|
-
it "should delegate to Chatterbox#logger" do
|
15
|
-
Chatterbox.expects(:logger)
|
16
|
-
helper.logger
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
13
|
describe "configuration" do
|
21
14
|
after do
|
22
15
|
Chatterbox::RailsCatcher.configure { |c| c.ignore = Chatterbox::RailsCatcher.default_ignored_exceptions }
|
@@ -3,14 +3,12 @@ require 'ostruct'
|
|
3
3
|
module Chatterbox
|
4
4
|
|
5
5
|
module RailsCatcher
|
6
|
-
delegate :logger, :to => Chatterbox
|
7
|
-
delegate :configuration, :to => self
|
8
6
|
|
9
7
|
def self.default_ignored_exceptions
|
10
8
|
['ActiveRecord::RecordNotFound', 'ActionController::RoutingError',
|
11
9
|
'ActionController::InvalidAuthenticityToken', 'ActionController::UnknownAction',
|
12
10
|
'CGI::Session::CookieStore::TamperedWithCookie' ]
|
13
|
-
|
11
|
+
end
|
14
12
|
|
15
13
|
def self.configuration
|
16
14
|
@configuration ||= OpenStruct.new(:ignore => default_ignored_exceptions)
|
@@ -31,23 +29,19 @@ module Chatterbox
|
|
31
29
|
# Overrides the rescue_action method in ActionController::Base, but does not inhibit
|
32
30
|
# any custom processing that is defined with Rails 2's exception helpers.
|
33
31
|
def rescue_action_in_public_with_chatterbox(exception)
|
34
|
-
logger.debug { "
|
32
|
+
Chatterbox.logger.debug { "Chatterbox caught exception #{exception} - about to handle" }
|
35
33
|
unless on_ignore_list?(exception)
|
36
34
|
Chatterbox.handle_notice(extract_exception_details(exception))
|
37
35
|
end
|
38
|
-
logger.debug { "
|
36
|
+
Chatterbox.logger.debug { "Chatterbox handing exception #{exception} off to normal rescue handling" }
|
39
37
|
rescue_action_in_public_without_chatterbox(exception)
|
40
38
|
end
|
41
39
|
|
42
40
|
private
|
43
41
|
|
44
|
-
def log_prefix
|
45
|
-
"#{self.class}#rescue_action_in_public_with_chatterbox:"
|
46
|
-
end
|
47
|
-
|
48
42
|
def on_ignore_list?(exception)
|
49
|
-
configuration.ignore.include?(exception.class) ||
|
50
|
-
configuration.ignore.include?(exception.class.to_s)
|
43
|
+
Chatterbox::RailsCatcher.configuration.ignore.include?(exception.class) ||
|
44
|
+
Chatterbox::RailsCatcher.configuration.ignore.include?(exception.class.to_s)
|
51
45
|
end
|
52
46
|
|
53
47
|
def extract_exception_details(exception)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatterbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- LICENSE
|
69
69
|
- README.markdown
|
70
70
|
- Rakefile
|
71
|
+
- VERSION.yml
|
71
72
|
- chatterbox.gemspec
|
72
73
|
- examples/example_helper.rb
|
73
74
|
- examples/lib/chatterbox/exception_notification/extracter_example.rb
|
@@ -92,7 +93,6 @@ files:
|
|
92
93
|
- lib/chatterbox/services/email/views/chatterbox/services/email/mailer/message.erb
|
93
94
|
- rails/init.rb
|
94
95
|
- todo.markdown
|
95
|
-
- version.yml
|
96
96
|
- views/chatterbox/mailer/exception_notification.erb
|
97
97
|
has_rdoc: true
|
98
98
|
homepage: http://github.com/rsanheim/chatterbox
|