bugsnag 6.20.0 → 6.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/VERSION +1 -1
- data/lib/bugsnag.rb +13 -3
- data/lib/bugsnag/configuration.rb +3 -3
- data/lib/bugsnag/integrations/railtie.rb +34 -35
- data/lib/bugsnag/middleware_stack.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d25c44a654cbfc8684f28ea8ae1853f3aa482abc2741574662afb8368ab8c5b2
|
4
|
+
data.tar.gz: a5c2462967da4d5995a7e07715a310bf5290019943395feef4a782290f2e34c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c2d1764646f0e7fa90fd7c6d9fd4f3811acde1da0cd110a5f186cd164d52fb61fe2a13add1d75f3fd492ccc4c034e63167a4f1c7f06e8586363b95a58788db
|
7
|
+
data.tar.gz: 64c6671f0cddbcdcc71e34ceb4719132f9e503a9e5be9ec73692348b3d023c3b68f572bba05489220dda5eea9f4a4fb89a3559f16d416eb19e6150bf86482640
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## v6.21.0 (23 June 2021)
|
5
|
+
|
6
|
+
### Enhancements
|
7
|
+
|
8
|
+
* Allow a `Method` or any object responding to `#call` to be used as an `on_error` callback or middleware
|
9
|
+
| [#662](https://github.com/bugsnag/bugsnag-ruby/pull/662)
|
10
|
+
| [odlp](https://github.com/odlp)
|
11
|
+
|
12
|
+
### Fixes
|
13
|
+
|
14
|
+
* Deliver when an error is raised in the block argument to `notify`
|
15
|
+
| [#660](https://github.com/bugsnag/bugsnag-ruby/pull/660)
|
16
|
+
| [aki77](https://github.com/aki77)
|
17
|
+
* Fix potential `NoMethodError` in `Bugsnag::Railtie` when using `require: false` in a Gemfile
|
18
|
+
| [#666](https://github.com/bugsnag/bugsnag-ruby/pull/666)
|
19
|
+
|
4
20
|
## v6.20.0 (29 March 2021)
|
5
21
|
|
6
22
|
### Enhancements
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.21.0
|
data/lib/bugsnag.rb
CHANGED
@@ -79,7 +79,12 @@ module Bugsnag
|
|
79
79
|
report = Report.new(exception, configuration, auto_notify)
|
80
80
|
|
81
81
|
# If this is an auto_notify we yield the block before the any middleware is run
|
82
|
-
|
82
|
+
begin
|
83
|
+
yield(report) if block_given? && auto_notify
|
84
|
+
rescue StandardError => e
|
85
|
+
configuration.warn("Error in internal notify block: #{e}")
|
86
|
+
configuration.warn("Error in internal notify block stacktrace: #{e.backtrace.inspect}")
|
87
|
+
end
|
83
88
|
|
84
89
|
if report.ignore?
|
85
90
|
configuration.debug("Not notifying #{report.exceptions.last[:errorClass]} due to ignore being signified in auto_notify block")
|
@@ -106,7 +111,12 @@ module Bugsnag
|
|
106
111
|
|
107
112
|
# If this is not an auto_notify then the block was provided by the user. This should be the last
|
108
113
|
# block that is run as it is the users "most specific" block.
|
109
|
-
|
114
|
+
begin
|
115
|
+
yield(report) if block_given? && !auto_notify
|
116
|
+
rescue StandardError => e
|
117
|
+
configuration.warn("Error in notify block: #{e}")
|
118
|
+
configuration.warn("Error in notify block stacktrace: #{e.backtrace.inspect}")
|
119
|
+
end
|
110
120
|
|
111
121
|
if report.ignore?
|
112
122
|
configuration.debug("Not notifying #{report.exceptions.last[:errorClass]} due to ignore being signified in user provided block")
|
@@ -265,7 +275,7 @@ module Bugsnag
|
|
265
275
|
# Returning false from an on_error callback will cause the error to be ignored
|
266
276
|
# and will prevent any remaining callbacks from being called
|
267
277
|
#
|
268
|
-
# @param callback [Proc]
|
278
|
+
# @param callback [Proc, Method, #call]
|
269
279
|
# @return [void]
|
270
280
|
def add_on_error(callback)
|
271
281
|
configuration.add_on_error(callback)
|
@@ -485,7 +485,7 @@ module Bugsnag
|
|
485
485
|
# Returning false from an on_error callback will cause the error to be ignored
|
486
486
|
# and will prevent any remaining callbacks from being called
|
487
487
|
#
|
488
|
-
# @param callback [Proc]
|
488
|
+
# @param callback [Proc, Method, #call]
|
489
489
|
# @return [void]
|
490
490
|
def add_on_error(callback)
|
491
491
|
middleware.use(callback)
|
@@ -494,10 +494,10 @@ module Bugsnag
|
|
494
494
|
##
|
495
495
|
# Remove the given callback from the list of on_error callbacks
|
496
496
|
#
|
497
|
-
# Note that this must be the same
|
497
|
+
# Note that this must be the same instance that was passed to
|
498
498
|
# {#add_on_error}, otherwise it will not be removed
|
499
499
|
#
|
500
|
-
# @param callback [Proc]
|
500
|
+
# @param callback [Proc, Method, #call]
|
501
501
|
# @return [void]
|
502
502
|
def remove_on_error(callback)
|
503
503
|
middleware.remove(callback)
|
@@ -9,11 +9,44 @@ require "bugsnag/integrations/rails/rails_breadcrumbs"
|
|
9
9
|
|
10
10
|
module Bugsnag
|
11
11
|
class Railtie < ::Rails::Railtie
|
12
|
-
|
13
12
|
FRAMEWORK_ATTRIBUTES = {
|
14
13
|
:framework => "Rails"
|
15
14
|
}
|
16
15
|
|
16
|
+
##
|
17
|
+
# Subscribes to an ActiveSupport event, leaving a breadcrumb when it triggers
|
18
|
+
#
|
19
|
+
# @api private
|
20
|
+
# @param event [Hash] details of the event to subscribe to
|
21
|
+
def event_subscription(event)
|
22
|
+
ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data|
|
23
|
+
filtered_data = data.slice(*event[:allowed_data])
|
24
|
+
filtered_data[:event_name] = event[:id]
|
25
|
+
filtered_data[:event_id] = event_id
|
26
|
+
|
27
|
+
if event[:id] == "sql.active_record"
|
28
|
+
if data.key?(:binds)
|
29
|
+
binds = data[:binds].each_with_object({}) { |bind, output| output[bind.name] = '?' if defined?(bind.name) }
|
30
|
+
filtered_data[:binds] = JSON.dump(binds) unless binds.empty?
|
31
|
+
end
|
32
|
+
|
33
|
+
# Rails < 6.1 included connection_id in the event data, but now
|
34
|
+
# includes the connection object instead
|
35
|
+
if data.key?(:connection) && !data.key?(:connection_id)
|
36
|
+
# the connection ID is the object_id of the connection object
|
37
|
+
filtered_data[:connection_id] = data[:connection].object_id
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Bugsnag.leave_breadcrumb(
|
42
|
+
event[:message],
|
43
|
+
filtered_data,
|
44
|
+
event[:type],
|
45
|
+
:auto
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
17
50
|
rake_tasks do
|
18
51
|
require "bugsnag/integrations/rake"
|
19
52
|
load "bugsnag/tasks/bugsnag.rake"
|
@@ -80,39 +113,5 @@ module Bugsnag
|
|
80
113
|
Bugsnag.configuration.warn("Unable to add Bugsnag::Rack middleware as the middleware stack is frozen")
|
81
114
|
end
|
82
115
|
end
|
83
|
-
|
84
|
-
##
|
85
|
-
# Subscribes to an ActiveSupport event, leaving a breadcrumb when it triggers
|
86
|
-
#
|
87
|
-
# @api private
|
88
|
-
# @param event [Hash] details of the event to subscribe to
|
89
|
-
def event_subscription(event)
|
90
|
-
ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data|
|
91
|
-
filtered_data = data.slice(*event[:allowed_data])
|
92
|
-
filtered_data[:event_name] = event[:id]
|
93
|
-
filtered_data[:event_id] = event_id
|
94
|
-
|
95
|
-
if event[:id] == "sql.active_record"
|
96
|
-
if data.key?(:binds)
|
97
|
-
binds = data[:binds].each_with_object({}) { |bind, output| output[bind.name] = '?' if defined?(bind.name) }
|
98
|
-
filtered_data[:binds] = JSON.dump(binds) unless binds.empty?
|
99
|
-
end
|
100
|
-
|
101
|
-
# Rails < 6.1 included connection_id in the event data, but now
|
102
|
-
# includes the connection object instead
|
103
|
-
if data.key?(:connection) && !data.key?(:connection_id)
|
104
|
-
# the connection ID is the object_id of the connection object
|
105
|
-
filtered_data[:connection_id] = data[:connection].object_id
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
Bugsnag.leave_breadcrumb(
|
110
|
-
event[:message],
|
111
|
-
filtered_data,
|
112
|
-
event[:type],
|
113
|
-
:auto
|
114
|
-
)
|
115
|
-
end
|
116
|
-
end
|
117
116
|
end
|
118
117
|
end
|
@@ -131,8 +131,8 @@ module Bugsnag
|
|
131
131
|
#
|
132
132
|
# @return [Array<Proc>]
|
133
133
|
def middleware_procs
|
134
|
-
# Split the middleware into separate lists of
|
135
|
-
|
134
|
+
# Split the middleware into separate lists of callables (e.g. Proc, Lambda, Method) and Classes
|
135
|
+
callables, classes = @middlewares.partition {|middleware| middleware.respond_to?(:call) }
|
136
136
|
|
137
137
|
# Wrap the classes in a proc that, when called, news up the middleware and
|
138
138
|
# passes the next middleware in the queue
|
@@ -140,12 +140,12 @@ module Bugsnag
|
|
140
140
|
proc {|next_middleware| middleware.new(next_middleware) }
|
141
141
|
end
|
142
142
|
|
143
|
-
# Wrap the list of
|
143
|
+
# Wrap the list of callables in a proc that, when called, wraps them in an
|
144
144
|
# 'OnErrorCallbacks' instance that also has a reference to the next middleware
|
145
|
-
|
145
|
+
wrapped_callables = proc {|next_middleware| OnErrorCallbacks.new(next_middleware, callables) }
|
146
146
|
|
147
|
-
# Return the combined middleware and wrapped
|
148
|
-
middleware_instances.push(
|
147
|
+
# Return the combined middleware and wrapped callables
|
148
|
+
middleware_instances.push(wrapped_callables)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|