chatterbox 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown
CHANGED
data/chatterbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chatterbox}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.5"
|
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"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-04}
|
13
13
|
s.description = %q{Send notifications and messages. However you want.}
|
14
14
|
s.email = %q{rsanheim@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,6 +17,12 @@ describe Chatterbox::ExceptionNotification do
|
|
17
17
|
Chatterbox::ExceptionNotification.configure { |c| c.ignore = Chatterbox::ExceptionNotification.default_ignored_exceptions }
|
18
18
|
end
|
19
19
|
|
20
|
+
it "does not notify" do
|
21
|
+
Chatterbox::ExceptionNotification.configure { |c| c.ignore << RuntimeError }
|
22
|
+
Chatterbox.expects(:notify).never
|
23
|
+
Chatterbox::ExceptionNotification.handle(:exception => RuntimeError.new)
|
24
|
+
end
|
25
|
+
|
20
26
|
it "returns nil for explicit exception" do
|
21
27
|
Chatterbox::ExceptionNotification.configure { |c| c.ignore << RuntimeError }
|
22
28
|
Chatterbox::ExceptionNotification.handle(RuntimeError.new).should be_nil
|
@@ -32,9 +38,22 @@ describe Chatterbox::ExceptionNotification do
|
|
32
38
|
Chatterbox.logger.expects(:debug).once
|
33
39
|
Chatterbox::ExceptionNotification.handle(RuntimeError.new)
|
34
40
|
end
|
41
|
+
|
42
|
+
describe "with the ignore list manually turned off" do
|
43
|
+
it "notifies" do
|
44
|
+
Chatterbox::ExceptionNotification.configure { |c| c.ignore << RuntimeError }
|
45
|
+
Chatterbox.expects(:notify)
|
46
|
+
Chatterbox::ExceptionNotification.handle(:exception => RuntimeError.new, :use_ignore_list => false)
|
47
|
+
end
|
48
|
+
end
|
35
49
|
end
|
36
50
|
|
37
51
|
describe "when not on ignore list" do
|
52
|
+
it "notifies" do
|
53
|
+
Chatterbox.expects(:notify)
|
54
|
+
Chatterbox::ExceptionNotification.handle(:exception => Exception.new)
|
55
|
+
end
|
56
|
+
|
38
57
|
it "logs nothing" do
|
39
58
|
Chatterbox.logger.expects(:debug).never
|
40
59
|
Chatterbox::ExceptionNotification.handle(:exception => Exception.new)
|
@@ -11,7 +11,7 @@ module Chatterbox
|
|
11
11
|
# * Objects are simply treated as a 'summary' message were an exception may not be necessary
|
12
12
|
def handle(args)
|
13
13
|
hsh = normalize_to_hash(args)
|
14
|
-
return if on_ignore_list?(hsh[:exception])
|
14
|
+
return if use_ignore_list?(hsh) && on_ignore_list?(hsh[:exception])
|
15
15
|
hsh = Extracter.wrap(hsh)
|
16
16
|
hsh = RailsExtracter.wrap(hsh)
|
17
17
|
hsh = Presenter.render(hsh)
|
@@ -26,6 +26,14 @@ module Chatterbox
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# Check to see if we should use ignore list for this exception -
|
30
|
+
# first use the value from the passed in options, otherwise
|
31
|
+
# use the configuration value (which defaults to true)
|
32
|
+
def use_ignore_list?(hsh)
|
33
|
+
return hsh[:use_ignore_list] if hsh.key?(:use_ignore_list)
|
34
|
+
configuration.use_ignore_list
|
35
|
+
end
|
36
|
+
|
29
37
|
def on_ignore_list?(exception)
|
30
38
|
ignored = configuration.ignore.include?(exception.class) ||
|
31
39
|
configuration.ignore.include?(exception.class.to_s)
|
@@ -37,8 +45,14 @@ module Chatterbox
|
|
37
45
|
Chatterbox.logger.debug { %[Chatterbox::ExceptionNotification ignoring exception: "#{exception}" as its on the ignore list] }
|
38
46
|
end
|
39
47
|
|
48
|
+
# Default configuration for ExceptionNotification
|
49
|
+
# :ignore => array of exceptions to ignore by default
|
50
|
+
# :use_ignore_list => whether to use the ignore list -
|
51
|
+
# defaults to true, and can be overidden on per exception level
|
40
52
|
def configuration
|
41
|
-
@configuration ||= OpenStruct.new(
|
53
|
+
@configuration ||= OpenStruct.new(
|
54
|
+
:ignore => default_ignored_exceptions,
|
55
|
+
:use_ignore_list => true)
|
42
56
|
end
|
43
57
|
|
44
58
|
# Configure ExceptionNotification
|
data/lib/chatterbox/version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-04 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|