exception_notification 4.1.3 → 4.1.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d847c323ad183933f5a1d63e29f06e9e8d6aaa9
|
4
|
+
data.tar.gz: 06b5d75b2ca566178384e2d8c60982b73aa1b567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d0744472e25aab1f35eaf6c66ab6ddd771885560fec22d3b60d6799ddff773689e1faf75af486b48280f59528fc119a54661474e0c56a86ed855799b213ba33
|
7
|
+
data.tar.gz: 2e51a10be77772151a0f866f81f105bf8b76d2d92bbd98537b36377db752592abd7704387380118bf3b40cb36c825b232f8bb26a41d7f27e5de9bb43928fbf60
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'exception_notification'
|
3
|
-
s.version = '4.1.
|
3
|
+
s.version = '4.1.4'
|
4
4
|
s.authors = ["Jamis Buck", "Josh Peek"]
|
5
|
-
s.date = %q{2015-12-22}
|
6
5
|
s.summary = "Exception notification for Rails apps"
|
7
6
|
s.homepage = "http://smartinez87.github.com/exception_notification"
|
8
7
|
s.email = "smartinez87@gmail.com"
|
@@ -14,11 +14,11 @@ module ExceptionNotifier
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def _pre_callback(exception, options, message, message_opts)
|
17
|
-
@base_options[:pre_callback].call(
|
17
|
+
@base_options[:pre_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call)
|
18
18
|
end
|
19
19
|
|
20
20
|
def _post_callback(exception, options, message, message_opts)
|
21
|
-
@base_options[:post_callback].call(
|
21
|
+
@base_options[:post_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call)
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -16,7 +16,7 @@ module ExceptionNotifier
|
|
16
16
|
@from = options.delete(:from) || 'Exception'
|
17
17
|
@room = HipChat::Client.new(api_token, opts)[room_name]
|
18
18
|
@message_template = options.delete(:message_template) || ->(exception) {
|
19
|
-
msg = "A new exception occurred: '#{exception.message}'"
|
19
|
+
msg = "A new exception occurred: '#{Rack::Utils.escape_html(exception.message)}'"
|
20
20
|
msg += " on '#{exception.backtrace.first}'" if exception.backtrace
|
21
21
|
msg
|
22
22
|
}
|
@@ -104,6 +104,22 @@ class HipchatNotifierTest < ActiveSupport::TestCase
|
|
104
104
|
hipchat.call(fake_exception)
|
105
105
|
end
|
106
106
|
|
107
|
+
test "should send hipchat notification with HTML-escaped meessage if using default message_template" do
|
108
|
+
options = {
|
109
|
+
:api_token => 'good_token',
|
110
|
+
:room_name => 'room_name',
|
111
|
+
:color => 'yellow',
|
112
|
+
}
|
113
|
+
|
114
|
+
exception = fake_exception_with_html_characters
|
115
|
+
body = "A new exception occurred: '#{Rack::Utils.escape_html(exception.message)}' on '#{exception.backtrace.first}'"
|
116
|
+
|
117
|
+
HipChat::Room.any_instance.expects(:send).with('Exception', body, { :color => 'yellow' })
|
118
|
+
|
119
|
+
hipchat = ExceptionNotifier::HipchatNotifier.new(options)
|
120
|
+
hipchat.call(exception)
|
121
|
+
end
|
122
|
+
|
107
123
|
test "should use APIv1 if api_version is not specified" do
|
108
124
|
options = {
|
109
125
|
:api_token => 'good_token',
|
@@ -143,6 +159,14 @@ class HipchatNotifierTest < ActiveSupport::TestCase
|
|
143
159
|
end
|
144
160
|
end
|
145
161
|
|
162
|
+
def fake_exception_with_html_characters
|
163
|
+
exception = begin
|
164
|
+
raise StandardError.new('an error with <html> characters')
|
165
|
+
rescue Exception => e
|
166
|
+
e
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
146
170
|
def fake_body_without_backtrace
|
147
171
|
"A new exception occurred: '#{fake_exception_without_backtrace.message}'"
|
148
172
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionmailer
|