raygun4ruby 1.3.0 → 1.4.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/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/raygun/client.rb +7 -4
- data/lib/raygun/configuration.rb +5 -1
- data/lib/raygun/version.rb +1 -1
- data/test/unit/client_test.rb +46 -1
- data/test/unit/configuration_test.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 997889cefe9c1b82cdd6d6705b89d180735022ab
|
4
|
+
data.tar.gz: 4639a0dc7117a6f0645927e22411670f117e759f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 878194b16e28a4acd08c76c2a164169162811eb4d033dfe251f5412a8ccbcc3c433fd28cd8bead36701dae82f360eba77fbbdef6d99b051725b3e467aced5c0e
|
7
|
+
data.tar.gz: 6a16be23e16879c829630638123a34ed28551739d91c86970a748d7a06530401e80218f9aa8ae55b4df0b01e54f3a169b1f7647d5aa7b6e988edc43476d1348a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Raygun 4 Ruby [](https://travis-ci.org/MindscapeHQ/raygun4ruby)
|
1
|
+
# Raygun 4 Ruby [](https://travis-ci.org/MindscapeHQ/raygun4ruby) [](https://badge.fury.io/rb/raygun4ruby)
|
2
2
|
|
3
3
|
This is the Ruby adapter for the Raygun error reporter, http://raygun.io.
|
4
4
|
|
data/lib/raygun/client.rb
CHANGED
@@ -8,8 +8,6 @@ module Raygun
|
|
8
8
|
|
9
9
|
include HTTParty
|
10
10
|
|
11
|
-
base_uri "https://api.raygun.io/"
|
12
|
-
|
13
11
|
def initialize
|
14
12
|
@api_key = require_api_key
|
15
13
|
@headers = {
|
@@ -17,6 +15,7 @@ module Raygun
|
|
17
15
|
}
|
18
16
|
|
19
17
|
enable_http_proxy if Raygun.configuration.proxy_settings[:address]
|
18
|
+
self.class.base_uri Raygun.configuration.api_url
|
20
19
|
end
|
21
20
|
|
22
21
|
def require_api_key
|
@@ -45,11 +44,15 @@ module Raygun
|
|
45
44
|
end
|
46
45
|
|
47
46
|
def error_details(exception)
|
48
|
-
{
|
47
|
+
details = {
|
49
48
|
className: exception.class.to_s,
|
50
49
|
message: exception.message.to_s.encode('UTF-16', :undef => :replace, :invalid => :replace).encode('UTF-8'),
|
51
|
-
stackTrace: (exception.backtrace || []).map { |line| stack_trace_for(line) }
|
50
|
+
stackTrace: (exception.backtrace || []).map { |line| stack_trace_for(line) },
|
52
51
|
}
|
52
|
+
|
53
|
+
details.update(innerError: error_details(exception.cause)) if exception.respond_to?(:cause) && exception.cause
|
54
|
+
|
55
|
+
details
|
53
56
|
end
|
54
57
|
|
55
58
|
def stack_trace_for(line)
|
data/lib/raygun/configuration.rb
CHANGED
@@ -67,6 +67,9 @@ module Raygun
|
|
67
67
|
# Set this to true to have raygun4ruby log the reason why it skips reporting an exception
|
68
68
|
config_option :debug
|
69
69
|
|
70
|
+
# Override this if you wish to connect to a different Raygun API than the standard one
|
71
|
+
config_option :api_url
|
72
|
+
|
70
73
|
# Exception classes to ignore by default
|
71
74
|
IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
|
72
75
|
'ActionController::RoutingError',
|
@@ -115,7 +118,8 @@ module Raygun
|
|
115
118
|
filter_payload_with_whitelist: false,
|
116
119
|
whitelist_payload_shape: DEFAULT_WHITELIST_PAYLOAD_SHAPE,
|
117
120
|
proxy_settings: {},
|
118
|
-
debug:
|
121
|
+
debug: false,
|
122
|
+
api_url: 'https://api.raygun.io/'
|
119
123
|
})
|
120
124
|
end
|
121
125
|
|
data/lib/raygun/version.rb
CHANGED
data/test/unit/client_test.rb
CHANGED
@@ -57,6 +57,37 @@ class ClientTest < Raygun::UnitTest
|
|
57
57
|
assert_equal expected_message, @client.send(:error_details, e)[:message]
|
58
58
|
end
|
59
59
|
|
60
|
+
def test_inner_error_details
|
61
|
+
oe = TestException.new("A test message")
|
62
|
+
oe.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'"])
|
63
|
+
|
64
|
+
ie = TestException.new("Inner test message")
|
65
|
+
ie.set_backtrace(["/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
66
|
+
|
67
|
+
e = nest_exceptions(oe, ie)
|
68
|
+
|
69
|
+
expected_hash = {
|
70
|
+
className: "ClientTest::TestException",
|
71
|
+
message: oe.message,
|
72
|
+
stackTrace: [
|
73
|
+
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" }
|
74
|
+
]
|
75
|
+
}
|
76
|
+
|
77
|
+
# test inner error according with its availability (ruby >= 2.1)
|
78
|
+
if e.respond_to? :cause
|
79
|
+
expected_hash[:innerError] = {
|
80
|
+
className: "ClientTest::TestException",
|
81
|
+
message: ie.message,
|
82
|
+
stackTrace: [
|
83
|
+
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run"}
|
84
|
+
]
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
assert_equal expected_hash, @client.send(:error_details, e)
|
89
|
+
end
|
90
|
+
|
60
91
|
def test_client_details
|
61
92
|
expected_hash = {
|
62
93
|
name: Raygun::CLIENT_NAME,
|
@@ -589,6 +620,21 @@ class ClientTest < Raygun::UnitTest
|
|
589
620
|
e
|
590
621
|
end
|
591
622
|
|
623
|
+
def nest_exceptions(outer_exception, inner_exception)
|
624
|
+
begin
|
625
|
+
begin
|
626
|
+
raise inner_exception.class, inner_exception.message
|
627
|
+
rescue => e
|
628
|
+
e.set_backtrace inner_exception.backtrace
|
629
|
+
raise outer_exception.class, outer_exception.message
|
630
|
+
end
|
631
|
+
rescue => nested_exception
|
632
|
+
nested_exception.set_backtrace outer_exception.backtrace
|
633
|
+
end
|
634
|
+
|
635
|
+
nested_exception
|
636
|
+
end
|
637
|
+
|
592
638
|
def exception_hash
|
593
639
|
{
|
594
640
|
className: "ClientTest::TestException",
|
@@ -618,5 +664,4 @@ class ClientTest < Raygun::UnitTest
|
|
618
664
|
"REMOTE_ADDR"=>"127.0.0.1"
|
619
665
|
}
|
620
666
|
end
|
621
|
-
|
622
667
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindscape
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-03-
|
12
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|