errdo 0.9.1 → 0.10.0
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 +4 -4
- data/app/models/errdo/exception.rb +3 -12
- data/lib/errdo/extension.rb +11 -0
- data/lib/errdo/notifications/slack/notification_adapter.rb +64 -0
- data/lib/errdo/notifications/slack.rb +3 -0
- data/lib/errdo/version.rb +1 -1
- data/lib/errdo.rb +21 -26
- data/lib/generators/templates/errdo.rb +9 -9
- data/test/dummy/config/initializers/errdo.rb +2 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +78233 -0
- data/test/integrations/plugins_integration_test.rb +7 -7
- metadata +4 -5
- data/lib/errdo/models/slack_messager.rb +0 -37
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
FAILSAFE_FAIL_STRING = "If you are the administrator of this website, then please read this web application's
|
3
|
+
FAILSAFE_FAIL_STRING = "If you are the administrator of this website, then please read this web application's \
|
4
|
+
log file and/or the web server's log file to find out what went wrong.".freeze
|
4
5
|
|
5
6
|
class PluginsIntegrationTest < ActionDispatch::IntegrationTest
|
6
7
|
|
7
8
|
setup do
|
8
|
-
Errdo.
|
9
|
-
Errdo.slack_webhook = "https://slack.com/test"
|
9
|
+
Errdo.notify_with slack: { webhook: "https://slack.com/test" }
|
10
10
|
end
|
11
11
|
|
12
12
|
context "slack integration" do
|
@@ -16,8 +16,8 @@ class PluginsIntegrationTest < ActionDispatch::IntegrationTest
|
|
16
16
|
assert_requested :any, /.*slack.*/
|
17
17
|
end
|
18
18
|
|
19
|
-
should "not send a slack notification when error is hit if webhook is
|
20
|
-
Errdo.
|
19
|
+
should "not send a slack notification when error is hit if webhook is not set" do
|
20
|
+
Errdo.instance_variable_set(:@notifiers, [])
|
21
21
|
stub_request :any, /.*slack.*/
|
22
22
|
get static_generic_error_path
|
23
23
|
assert_not_requested :any, /.*slack.*/
|
@@ -28,6 +28,7 @@ class PluginsIntegrationTest < ActionDispatch::IntegrationTest
|
|
28
28
|
stub_request :any, /.*slack.*/
|
29
29
|
get static_generic_error_path
|
30
30
|
assert_requested :any, /.*slack.*/
|
31
|
+
Errdo.error_name = :errors
|
31
32
|
end
|
32
33
|
|
33
34
|
should "not fail when the slack ping returns an error" do
|
@@ -38,8 +39,7 @@ class PluginsIntegrationTest < ActionDispatch::IntegrationTest
|
|
38
39
|
end
|
39
40
|
|
40
41
|
teardown do
|
41
|
-
Errdo.instance_variable_set(:@
|
42
|
-
Errdo.slack_webhook = nil
|
42
|
+
Errdo.instance_variable_set(:@notifiers, [])
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errdo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- erichaydel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -164,8 +164,9 @@ files:
|
|
164
164
|
- lib/errdo/extensions/cancancan/authorization_adapter.rb
|
165
165
|
- lib/errdo/helpers/views_helper.rb
|
166
166
|
- lib/errdo/models/error_env_parser.rb
|
167
|
-
- lib/errdo/models/slack_messager.rb
|
168
167
|
- lib/errdo/models/user_parser.rb
|
168
|
+
- lib/errdo/notifications/slack.rb
|
169
|
+
- lib/errdo/notifications/slack/notification_adapter.rb
|
169
170
|
- lib/errdo/version.rb
|
170
171
|
- lib/generators/active_record/errdo_generator.rb
|
171
172
|
- lib/generators/active_record/templates/migration.rb
|
@@ -979,7 +980,6 @@ files:
|
|
979
980
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/zt/zt98H6qoLRpSDbtbVQtghzuYtOz1-Po0QcDAVWK7XC4.cache
|
980
981
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/zv/zvfByn9a2SXSz6mb_B5wkAIJMltXb2gON_PpjV8Gyl0.cache
|
981
982
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/zw/zwqTCzApUNMz710-JBgR6nos_fF_00TLDbBMbRhMAyw.cache
|
982
|
-
- test/dummy/tmp/pids/server.pid
|
983
983
|
- test/factories.rb
|
984
984
|
- test/fixtures/users.yml
|
985
985
|
- test/generators/active_record_generator_test.rb
|
@@ -1808,7 +1808,6 @@ test_files:
|
|
1808
1808
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/D_/D_KcfHEBsRaZDGqaiFtERXr1g8Av54-9T958jUK7R0A.cache
|
1809
1809
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/ED/EDVZLiJoq6wj93pJxKsK4TI15LIXRqwx4OdFGAAr068.cache
|
1810
1810
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/Ip/IplSosjlbQ5aan_h10fBG52WhsI8ogweDeukCOuwPWI.cache
|
1811
|
-
- test/dummy/tmp/pids/server.pid
|
1812
1811
|
- test/dummy/README.rdoc
|
1813
1812
|
- test/dummy/bin/bundle
|
1814
1813
|
- test/dummy/bin/setup
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Errdo
|
2
|
-
module Models
|
3
|
-
class SlackMessager
|
4
|
-
|
5
|
-
include Errdo::Helpers::ViewsHelper # For the naming of the user in the message
|
6
|
-
|
7
|
-
def initialize(error, parser)
|
8
|
-
if error.nil?
|
9
|
-
@user = parser.user
|
10
|
-
@backtrace = parser.short_backtrace
|
11
|
-
@exception_name = parser.exception_name
|
12
|
-
@exception_message = parser.exception_message
|
13
|
-
else
|
14
|
-
@user = error.last_experiencer
|
15
|
-
@backtrace = error.short_backtrace
|
16
|
-
@exception_name = error.exception_class_name
|
17
|
-
@exception_message = error.exception_message
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def message
|
22
|
-
"#{exception_string}#{user_message_addon}\n#{@backtrace}"
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def exception_string
|
28
|
-
"#{@exception_name} | #{@exception_message}"
|
29
|
-
end
|
30
|
-
|
31
|
-
def user_message_addon
|
32
|
-
"\nExperienced by #{user_show_string(@user)} " if @user
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
4358
|