sentry-raven 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.craft.yml +1 -1
- data/.github/workflows/test.yml +36 -26
- data/.github/workflows/zeus_upload.yml +32 -0
- data/{changelog.md → CHANGELOG.md} +15 -7
- data/CONTRIUTING.md +26 -0
- data/Gemfile +5 -2
- data/README.md +4 -4
- data/lib/raven/base.rb +1 -0
- data/lib/raven/cli.rb +7 -18
- data/lib/raven/client.rb +10 -27
- data/lib/raven/core_ext/object/deep_dup.rb +57 -0
- data/lib/raven/core_ext/object/duplicable.rb +153 -0
- data/lib/raven/event.rb +19 -0
- data/lib/raven/instance.rb +1 -0
- data/lib/raven/processor/cookies.rb +1 -1
- data/lib/raven/processor/removecircularreferences.rb +2 -1
- data/lib/raven/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80521c1a75c0ad22be530ffd95d497c5faa6def9d88d21dceecf3b7dacecb7a8
|
4
|
+
data.tar.gz: 1c1302782b979b2cf098ef0a90b71d69a65f733af2f95d588b4ae71e0ab67922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cd7c853ace426bd428037ea0cf436b781511beded44373fea677a06f58e7a6200f0ddad9d9777fb12468954b344e4035a7a275427a65ff38e6cb618317e7198
|
7
|
+
data.tar.gz: ab5c38a374dc93fffa6baf9b9284795c3790e3db247848a9b39d7aa4902a3045375c24cea5e480cee25758bab96fe6f4c79c2fdae43c1f80ad25f171c443ba1f
|
data/.craft.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
name: Test
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
4
|
push:
|
5
5
|
branches:
|
6
6
|
- master
|
7
|
-
- release/**
|
8
7
|
pull_request:
|
9
8
|
jobs:
|
10
9
|
test:
|
@@ -47,31 +46,42 @@ jobs:
|
|
47
46
|
- name: Build with Rails ${{ matrix.rails_version }}
|
48
47
|
env:
|
49
48
|
RAILS_VERSION: ${{ matrix.rails_version }}
|
50
|
-
run: |
|
49
|
+
run: |
|
51
50
|
bundle install --jobs 4 --retry 3
|
52
51
|
bundle exec rake
|
53
52
|
|
54
|
-
|
55
|
-
name:
|
56
|
-
runs-on:
|
53
|
+
compare_allocation:
|
54
|
+
name: Compare memory allocation with ${{ matrix.ruby_version }} and rails ${{ matrix.rails_version }}
|
55
|
+
runs-on: ${{ matrix.os }}
|
56
|
+
needs: test
|
57
|
+
env:
|
58
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
59
|
+
strategy:
|
60
|
+
matrix:
|
61
|
+
rails_version: [5.2, 6.0]
|
62
|
+
ruby_version: [2.6, 2.7]
|
63
|
+
os: [ubuntu-latest]
|
57
64
|
steps:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
65
|
+
- name: Set up Ruby ${{ matrix.ruby_version }}
|
66
|
+
uses: ruby/setup-ruby@v1
|
67
|
+
with:
|
68
|
+
bundler: 1
|
69
|
+
ruby-version: ${{ matrix.ruby_version }}
|
70
|
+
|
71
|
+
- uses: actions/checkout@v2
|
72
|
+
with:
|
73
|
+
ref: master
|
74
|
+
|
75
|
+
- name: Build and run allocation report on master
|
76
|
+
run: |
|
77
|
+
bundle install --jobs 4 --retry 3
|
78
|
+
bundle exec ruby benchmarks/allocation_comparison.rb
|
79
|
+
|
80
|
+
- uses: actions/checkout@v1
|
81
|
+
|
82
|
+
- name: Rebuild on the branch
|
83
|
+
run: |
|
84
|
+
bundle install --jobs 4 --retry 3
|
85
|
+
- name: Run allocation report on the branch
|
86
|
+
run: |
|
87
|
+
bundle exec ruby benchmarks/allocation_comparison.rb
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Zeus Upload
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- release/**
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
zeus_upload:
|
10
|
+
name: Zeus
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: actions/setup-node@v1
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 2.6 # Not needed with a .ruby-version file
|
19
|
+
- run: bundle install
|
20
|
+
- name: Install Zeus
|
21
|
+
run: |
|
22
|
+
yarn global add @zeus-ci/cli
|
23
|
+
echo "::add-path::$(yarn global bin)"
|
24
|
+
- name: Upload to Zeus
|
25
|
+
env:
|
26
|
+
ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }}
|
27
|
+
ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
|
28
|
+
run: |
|
29
|
+
zeus job update -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
|
30
|
+
gem build sentry-raven.gemspec
|
31
|
+
zeus upload -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -t "application/tar+gem" ./*.gem
|
32
|
+
zeus job update --status=passed -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
|
@@ -2,17 +2,25 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 3.0.3
|
6
|
+
|
7
|
+
- fix: Ensure Processor::Cookie can run after Processor::RemoveCircularReferences (#996)
|
8
|
+
- fix: Avoid mutating user passed in options (#994)
|
9
|
+
- fix: Fix/Refactor Raven::Cli (#989)
|
10
|
+
- ref: Refactor Raven::Client class (#995)
|
11
|
+
- It adds `Event#message_from_exception` and `Event#log_message` interfaces
|
12
|
+
|
5
13
|
## 3.0.2
|
6
14
|
|
7
|
-
|
15
|
+
- fix: Add gem target for craft
|
8
16
|
|
9
17
|
## 3.0.1
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
- fix: Improve SanitizeData processor (#984)
|
20
|
+
- fix: Masking cookies as key/pair instead of a single string (#983)
|
21
|
+
- fix: Transports classes' requiring issue (#986)
|
22
|
+
- fix: Frozen string issues (#977)
|
23
|
+
- feat: Officially support Rails 6 (#982)
|
16
24
|
|
17
25
|
3.0.0
|
18
26
|
----
|
@@ -499,7 +507,7 @@ OTHER CHANGES:
|
|
499
507
|
0.12.0
|
500
508
|
------
|
501
509
|
|
502
|
-
- You can now give additional fields to the SanitizeData processor. Values matched are replaced by the string mask (*********). Full documentation (and how to use with Rails config.filter_parameters) [here](https://docs.
|
510
|
+
- You can now give additional fields to the SanitizeData processor. Values matched are replaced by the string mask (*********). Full documentation (and how to use with Rails config.filter_parameters) [here](https://docs.sentry.io/platforms/ruby/config/). [jamescway, #232]
|
503
511
|
- An additional processor has been added, though it isn't turned on by default: RemoveStacktrace. Use it to remove stacktraces from exception reports. [nateberkopec, #233]
|
504
512
|
- Dependency on `uuidtools` has been removed. [nateberkopec, #231]
|
505
513
|
|
data/CONTRIUTING.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://sentry.io" target="_blank" align="center">
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
|
4
|
+
</a>
|
5
|
+
<br />
|
6
|
+
</p>
|
7
|
+
|
8
|
+
# Contributing
|
9
|
+
|
10
|
+
We welcome suggested improvements and bug fixes in the form of pull requests. The guide below will help you get started, but if you have further questions, please feel free to reach out on [Discord](https://discord.gg/Ww9hbqr).
|
11
|
+
|
12
|
+
|
13
|
+
## Making a release
|
14
|
+
|
15
|
+
Install and use `craft`: https://github.com/getsentry/craft
|
16
|
+
|
17
|
+
Make sure the `CHANGELOG.md` is update and latest `master` contains all changes.
|
18
|
+
|
19
|
+
Run:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
craft prepare x.x.x
|
23
|
+
```
|
24
|
+
|
25
|
+
Where `x.x.x` stands for the version you want to release.
|
26
|
+
Afterwards reach out to an employee of Sentry, they will cut a release by running the `publish` process of `craft`.
|
data/Gemfile
CHANGED
@@ -2,9 +2,10 @@ source "https://rubygems.org/"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
rails_version = ENV["RAILS_VERSION"]
|
5
|
+
rails_version = ENV["RAILS_VERSION"]
|
6
|
+
rails_version = "5.2" if rails_version.nil?
|
6
7
|
|
7
|
-
if rails_version != 0
|
8
|
+
if rails_version.to_f != 0
|
8
9
|
gem "rails", "~> #{rails_version}"
|
9
10
|
gem "rspec-rails", "~> 4.0"
|
10
11
|
end
|
@@ -16,7 +17,9 @@ gem "rack-timeout"
|
|
16
17
|
|
17
18
|
gem "pry"
|
18
19
|
gem "benchmark-ips"
|
20
|
+
gem "benchmark_driver"
|
19
21
|
gem "benchmark-ipsa"
|
22
|
+
gem "benchmark-memory"
|
20
23
|
gem "ruby-prof", platform: :mri
|
21
24
|
gem "rake", "> 12"
|
22
25
|
gem "rubocop", "~> 0.81.0"
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ We test on Ruby 2.3, 2.4, 2.5, 2.6 and 2.7 at the latest patchlevel/teeny versio
|
|
30
30
|
gem "sentry-raven"
|
31
31
|
```
|
32
32
|
|
33
|
-
### Raven only runs when
|
33
|
+
### Raven only runs when Sentry DSN is set
|
34
34
|
|
35
35
|
Raven will capture and send exceptions to the Sentry server whenever its DSN is set. This makes environment-based configuration easy - if you don't want to send errors in a certain environment, just don't set the DSN in that environment!
|
36
36
|
|
@@ -39,7 +39,7 @@ Raven will capture and send exceptions to the Sentry server whenever its DSN is
|
|
39
39
|
export SENTRY_DSN=http://public@example.com/project-id
|
40
40
|
```
|
41
41
|
```ruby
|
42
|
-
# Or you can configure the client in the code
|
42
|
+
# Or you can configure the client in the code.
|
43
43
|
Raven.configure do |config|
|
44
44
|
config.dsn = 'http://public@example.com/project-id'
|
45
45
|
end
|
@@ -49,11 +49,11 @@ end
|
|
49
49
|
|
50
50
|
**Raven ignores some exceptions by default** - most of these are related to 404s or controller actions not being found. [For a complete list, see the `IGNORE_DEFAULT` constant](https://github.com/getsentry/raven-ruby/blob/master/lib/raven/configuration.rb).
|
51
51
|
|
52
|
-
Raven doesn't report POST data or cookies by default. In addition, it will attempt to remove any obviously sensitive data, such as credit card or Social Security numbers. For more information about how Sentry processes your data, [check out the documentation on the `processors` config setting.](https://docs.
|
52
|
+
Raven doesn't report POST data or cookies by default. In addition, it will attempt to remove any obviously sensitive data, such as credit card or Social Security numbers. For more information about how Sentry processes your data, [check out the documentation on the `processors` config setting.](https://docs.sentry.io/platforms/ruby/config/)
|
53
53
|
|
54
54
|
### Usage
|
55
55
|
|
56
|
-
**If you use Rails, you're already done - no more configuration required!** Check [Integrations](https://docs.
|
56
|
+
**If you use Rails, you're already done - no more configuration required!** Check [Integrations](https://docs.sentry.io/platforms/ruby/integrations/) for more details on other gems Sentry integrates with automatically.
|
57
57
|
|
58
58
|
Otherwise, Raven supports two methods of capturing exceptions:
|
59
59
|
|
data/lib/raven/base.rb
CHANGED
data/lib/raven/cli.rb
CHANGED
@@ -18,7 +18,7 @@ module Raven
|
|
18
18
|
|
19
19
|
# wipe out env settings to ensure we send the event
|
20
20
|
unless config.capture_allowed?
|
21
|
-
env_name = config.environments.
|
21
|
+
env_name = config.environments.last || 'production'
|
22
22
|
config.current_environment = env_name
|
23
23
|
end
|
24
24
|
|
@@ -33,27 +33,16 @@ module Raven
|
|
33
33
|
evt = instance.capture_exception(e)
|
34
34
|
end
|
35
35
|
|
36
|
-
if evt
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
elsif evt # async configuration
|
43
|
-
if evt.value.is_a? Hash
|
44
|
-
instance.logger.debug "-> event ID: #{evt.value[:event_id]}"
|
45
|
-
else
|
46
|
-
instance.logger.debug "-> event ID: #{evt.value.id}"
|
47
|
-
end
|
36
|
+
if evt
|
37
|
+
instance.logger.debug "-> event ID: #{evt.id}"
|
38
|
+
instance.logger.debug ""
|
39
|
+
instance.logger.debug "Done!"
|
40
|
+
evt
|
48
41
|
else
|
49
42
|
instance.logger.debug ""
|
50
43
|
instance.logger.debug "An error occurred while attempting to send the event."
|
51
|
-
|
44
|
+
false
|
52
45
|
end
|
53
|
-
|
54
|
-
instance.logger.debug ""
|
55
|
-
instance.logger.debug "Done!"
|
56
|
-
evt
|
57
46
|
end
|
58
47
|
end
|
59
48
|
end
|
data/lib/raven/client.rb
CHANGED
@@ -30,18 +30,15 @@ module Raven
|
|
30
30
|
return
|
31
31
|
end
|
32
32
|
|
33
|
-
# Convert to hash
|
34
|
-
event = event.to_hash
|
35
|
-
|
36
33
|
unless @state.should_try?
|
37
34
|
failed_send(nil, event)
|
38
35
|
return
|
39
36
|
end
|
40
37
|
|
41
|
-
|
42
|
-
configuration.logger.info "Sending event #{event_id} to Sentry"
|
38
|
+
configuration.logger.info "Sending event #{event.event_id} to Sentry"
|
43
39
|
|
44
|
-
|
40
|
+
event_hash = event.to_hash
|
41
|
+
content_type, encoded_data = encode(event_hash)
|
45
42
|
|
46
43
|
begin
|
47
44
|
transport.send_event(generate_auth_header, encoded_data,
|
@@ -52,7 +49,7 @@ module Raven
|
|
52
49
|
return
|
53
50
|
end
|
54
51
|
|
55
|
-
|
52
|
+
event_hash
|
56
53
|
end
|
57
54
|
|
58
55
|
def transport
|
@@ -71,8 +68,8 @@ module Raven
|
|
71
68
|
|
72
69
|
private
|
73
70
|
|
74
|
-
def encode(
|
75
|
-
hash = @processors.reduce(
|
71
|
+
def encode(event_hash)
|
72
|
+
hash = @processors.reduce(event_hash) { |a, e| e.process(a) }
|
76
73
|
encoded = JSON.fast_generate(hash)
|
77
74
|
|
78
75
|
case configuration.encoding
|
@@ -83,22 +80,6 @@ module Raven
|
|
83
80
|
end
|
84
81
|
end
|
85
82
|
|
86
|
-
def get_message_from_exception(event)
|
87
|
-
(
|
88
|
-
event &&
|
89
|
-
event[:exception] &&
|
90
|
-
event[:exception][:values] &&
|
91
|
-
event[:exception][:values][0] &&
|
92
|
-
event[:exception][:values][0][:type] &&
|
93
|
-
event[:exception][:values][0][:value] &&
|
94
|
-
"#{event[:exception][:values][0][:type]}: #{event[:exception][:values][0][:value]}"
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
def get_log_message(event)
|
99
|
-
(event && event[:message]) || (event && event['message']) || get_message_from_exception(event) || '<no message value>'
|
100
|
-
end
|
101
|
-
|
102
83
|
def generate_auth_header
|
103
84
|
now = Time.now.to_i.to_s
|
104
85
|
fields = {
|
@@ -122,10 +103,12 @@ module Raven
|
|
122
103
|
else
|
123
104
|
configuration.logger.warn "Not sending event due to previous failure(s)."
|
124
105
|
end
|
125
|
-
|
106
|
+
|
107
|
+
event_message = event&.log_message || '<no message value>'
|
108
|
+
configuration.logger.warn("Failed to submit event: #{event_message}")
|
126
109
|
|
127
110
|
# configuration.transport_failure_callback can be false & nil
|
128
|
-
configuration.transport_failure_callback.call(event) if configuration.transport_failure_callback # rubocop:disable Style/SafeNavigation
|
111
|
+
configuration.transport_failure_callback.call(event.to_hash) if configuration.transport_failure_callback # rubocop:disable Style/SafeNavigation
|
129
112
|
end
|
130
113
|
end
|
131
114
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'raven/core_ext/object/duplicable'
|
2
|
+
|
3
|
+
#########################################
|
4
|
+
# This file was copied from Rails 5.2 #
|
5
|
+
#########################################
|
6
|
+
|
7
|
+
class Object
|
8
|
+
# Returns a deep copy of object if it's duplicable. If it's
|
9
|
+
# not duplicable, returns +self+.
|
10
|
+
#
|
11
|
+
# object = Object.new
|
12
|
+
# dup = object.deep_dup
|
13
|
+
# dup.instance_variable_set(:@a, 1)
|
14
|
+
#
|
15
|
+
# object.instance_variable_defined?(:@a) # => false
|
16
|
+
# dup.instance_variable_defined?(:@a) # => true
|
17
|
+
def deep_dup
|
18
|
+
duplicable? ? dup : self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Array
|
23
|
+
# Returns a deep copy of array.
|
24
|
+
#
|
25
|
+
# array = [1, [2, 3]]
|
26
|
+
# dup = array.deep_dup
|
27
|
+
# dup[1][2] = 4
|
28
|
+
#
|
29
|
+
# array[1][2] # => nil
|
30
|
+
# dup[1][2] # => 4
|
31
|
+
def deep_dup
|
32
|
+
map(&:deep_dup)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Hash
|
37
|
+
# Returns a deep copy of hash.
|
38
|
+
#
|
39
|
+
# hash = { a: { b: 'b' } }
|
40
|
+
# dup = hash.deep_dup
|
41
|
+
# dup[:a][:c] = 'c'
|
42
|
+
#
|
43
|
+
# hash[:a][:c] # => nil
|
44
|
+
# dup[:a][:c] # => "c"
|
45
|
+
def deep_dup
|
46
|
+
hash = dup
|
47
|
+
each_pair do |key, value|
|
48
|
+
if key.frozen? && ::String === key
|
49
|
+
hash[key] = value.deep_dup
|
50
|
+
else
|
51
|
+
hash.delete(key)
|
52
|
+
hash[key.deep_dup] = value.deep_dup
|
53
|
+
end
|
54
|
+
end
|
55
|
+
hash
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#########################################
|
4
|
+
# This file was copied from Rails 5.2 #
|
5
|
+
#########################################
|
6
|
+
|
7
|
+
#--
|
8
|
+
# Most objects are cloneable, but not all. For example you can't dup methods:
|
9
|
+
#
|
10
|
+
# method(:puts).dup # => TypeError: allocator undefined for Method
|
11
|
+
#
|
12
|
+
# Classes may signal their instances are not duplicable removing +dup+/+clone+
|
13
|
+
# or raising exceptions from them. So, to dup an arbitrary object you normally
|
14
|
+
# use an optimistic approach and are ready to catch an exception, say:
|
15
|
+
#
|
16
|
+
# arbitrary_object.dup rescue object
|
17
|
+
#
|
18
|
+
# Rails dups objects in a few critical spots where they are not that arbitrary.
|
19
|
+
# That rescue is very expensive (like 40 times slower than a predicate), and it
|
20
|
+
# is often triggered.
|
21
|
+
#
|
22
|
+
# That's why we hardcode the following cases and check duplicable? instead of
|
23
|
+
# using that rescue idiom.
|
24
|
+
#++
|
25
|
+
class Object
|
26
|
+
# Can you safely dup this object?
|
27
|
+
#
|
28
|
+
# False for method objects;
|
29
|
+
# true otherwise.
|
30
|
+
def duplicable?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class NilClass
|
36
|
+
begin
|
37
|
+
nil.dup
|
38
|
+
rescue TypeError
|
39
|
+
# +nil+ is not duplicable:
|
40
|
+
#
|
41
|
+
# nil.duplicable? # => false
|
42
|
+
# nil.dup # => TypeError: can't dup NilClass
|
43
|
+
def duplicable?
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class FalseClass
|
50
|
+
begin
|
51
|
+
false.dup
|
52
|
+
rescue TypeError
|
53
|
+
# +false+ is not duplicable:
|
54
|
+
#
|
55
|
+
# false.duplicable? # => false
|
56
|
+
# false.dup # => TypeError: can't dup FalseClass
|
57
|
+
def duplicable?
|
58
|
+
false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class TrueClass
|
64
|
+
begin
|
65
|
+
true.dup
|
66
|
+
rescue TypeError
|
67
|
+
# +true+ is not duplicable:
|
68
|
+
#
|
69
|
+
# true.duplicable? # => false
|
70
|
+
# true.dup # => TypeError: can't dup TrueClass
|
71
|
+
def duplicable?
|
72
|
+
false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class Symbol
|
78
|
+
begin
|
79
|
+
:symbol.dup # Ruby 2.4.x.
|
80
|
+
"symbol_from_string".to_sym.dup # Some symbols can't `dup` in Ruby 2.4.0.
|
81
|
+
rescue TypeError
|
82
|
+
# Symbols are not duplicable:
|
83
|
+
#
|
84
|
+
# :my_symbol.duplicable? # => false
|
85
|
+
# :my_symbol.dup # => TypeError: can't dup Symbol
|
86
|
+
def duplicable?
|
87
|
+
false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class Numeric
|
93
|
+
begin
|
94
|
+
1.dup
|
95
|
+
rescue TypeError
|
96
|
+
# Numbers are not duplicable:
|
97
|
+
#
|
98
|
+
# 3.duplicable? # => false
|
99
|
+
# 3.dup # => TypeError: can't dup Integer
|
100
|
+
def duplicable?
|
101
|
+
false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
require "bigdecimal"
|
107
|
+
class BigDecimal
|
108
|
+
# BigDecimals are duplicable:
|
109
|
+
#
|
110
|
+
# BigDecimal("1.2").duplicable? # => true
|
111
|
+
# BigDecimal("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)>
|
112
|
+
def duplicable?
|
113
|
+
true
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
class Method
|
118
|
+
# Methods are not duplicable:
|
119
|
+
#
|
120
|
+
# method(:puts).duplicable? # => false
|
121
|
+
# method(:puts).dup # => TypeError: allocator undefined for Method
|
122
|
+
def duplicable?
|
123
|
+
false
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class Complex
|
128
|
+
begin
|
129
|
+
Complex(1).dup
|
130
|
+
rescue TypeError
|
131
|
+
# Complexes are not duplicable:
|
132
|
+
#
|
133
|
+
# Complex(1).duplicable? # => false
|
134
|
+
# Complex(1).dup # => TypeError: can't copy Complex
|
135
|
+
def duplicable?
|
136
|
+
false
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
class Rational
|
142
|
+
begin
|
143
|
+
Rational(1).dup
|
144
|
+
rescue TypeError
|
145
|
+
# Rationals are not duplicable:
|
146
|
+
#
|
147
|
+
# Rational(1).duplicable? # => false
|
148
|
+
# Rational(1).dup # => TypeError: can't copy Rational
|
149
|
+
def duplicable?
|
150
|
+
false
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
data/lib/raven/event.rb
CHANGED
@@ -136,6 +136,25 @@ module Raven
|
|
136
136
|
JSON.parse(JSON.generate(cleaned_hash))
|
137
137
|
end
|
138
138
|
|
139
|
+
def message_from_exception
|
140
|
+
exception = @interfaces[:exception]
|
141
|
+
|
142
|
+
return unless exception
|
143
|
+
|
144
|
+
exception = exception.to_hash
|
145
|
+
|
146
|
+
type = exception.dig(:values, 0, :type)
|
147
|
+
value = exception.dig(:values, 0, :value)
|
148
|
+
|
149
|
+
if type && value
|
150
|
+
"#{type}: #{value}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def log_message
|
155
|
+
message || message_from_exception
|
156
|
+
end
|
157
|
+
|
139
158
|
def add_exception_interface(exc)
|
140
159
|
interface(:exception) do |exc_int|
|
141
160
|
exceptions = Raven::Utils::ExceptionCauseChain.exception_to_array(exc).reverse
|
data/lib/raven/instance.rb
CHANGED
@@ -110,6 +110,7 @@ module Raven
|
|
110
110
|
end
|
111
111
|
|
112
112
|
message_or_exc = obj.is_a?(String) ? "message" : "exception"
|
113
|
+
options = options.deep_dup
|
113
114
|
options[:configuration] = configuration
|
114
115
|
options[:context] = context
|
115
116
|
if evt = Event.send("from_" + message_or_exc, obj, options)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Raven
|
2
2
|
class Processor::RemoveCircularReferences < Processor
|
3
|
+
ELISION_STRING = "(...)".freeze
|
3
4
|
def process(value, visited = [])
|
4
|
-
return
|
5
|
+
return ELISION_STRING if visited.include?(value.__id__)
|
5
6
|
|
6
7
|
visited << value.__id__ if value.is_a?(Array) || value.is_a?(Hash)
|
7
8
|
|
data/lib/raven/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-raven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -35,16 +35,18 @@ extra_rdoc_files:
|
|
35
35
|
files:
|
36
36
|
- ".craft.yml"
|
37
37
|
- ".github/workflows/test.yml"
|
38
|
+
- ".github/workflows/zeus_upload.yml"
|
38
39
|
- ".gitignore"
|
39
40
|
- ".gitmodules"
|
40
41
|
- ".rspec"
|
41
42
|
- ".rubocop.yml"
|
42
43
|
- ".scripts/bump-version.sh"
|
44
|
+
- CHANGELOG.md
|
45
|
+
- CONTRIUTING.md
|
43
46
|
- Gemfile
|
44
47
|
- LICENSE
|
45
48
|
- README.md
|
46
49
|
- Rakefile
|
47
|
-
- changelog.md
|
48
50
|
- exe/raven
|
49
51
|
- lib/raven.rb
|
50
52
|
- lib/raven/backtrace.rb
|
@@ -56,6 +58,8 @@ files:
|
|
56
58
|
- lib/raven/client.rb
|
57
59
|
- lib/raven/configuration.rb
|
58
60
|
- lib/raven/context.rb
|
61
|
+
- lib/raven/core_ext/object/deep_dup.rb
|
62
|
+
- lib/raven/core_ext/object/duplicable.rb
|
59
63
|
- lib/raven/event.rb
|
60
64
|
- lib/raven/instance.rb
|
61
65
|
- lib/raven/integrations/delayed_job.rb
|