bugsnag 5.3.3 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0f59a73d8f4b8c5594828664573e892ecf8bd49
4
- data.tar.gz: ec14896b7774fac186b1db8e42c5e41b233e4555
3
+ metadata.gz: 1d3869fd6bf3186cfc8d91a049cba4a365d97b64
4
+ data.tar.gz: fb2cd85bf8583242d04d10f7962cae0dc19d6b6c
5
5
  SHA512:
6
- metadata.gz: 4a20576b59c6a146d2290a6a65a8ac13d30c75aaa76f0b2cfd216d0c7505b36af8a10b4f0269bc869e926b50c844cf435bd10634fc5c118e251f85b9d8bd3d59
7
- data.tar.gz: 52fbb7da5f06de0f178c3c0d3b37c84cdbdcd79421923764a26dd6753b400fd509df3efe62862d51fe55a888d2b5db39eb711812e5470df82588d49b1bb03d05
6
+ metadata.gz: 28e4baccdf37a126880827fe389c19ae3c2e44719257509fdcb031192a7485d6b879bec48f2440c34ec1a76a716db68a3076d9567368f50d9e6d2f8363b73559
7
+ data.tar.gz: ea9958e1172c387a2b6b6c1864218be3489870f66e2f68ff6e007e46d1724ab9baa40d06760e0ed00b9c0f0412f0d8869d8450c5bcc7932433ccebb6308e0840
@@ -10,4 +10,7 @@ rvm:
10
10
  - jruby-19mode
11
11
 
12
12
  before_install:
13
+ - gem install bundler -v 1.12
14
+ - gem update --system
15
+ - bundle --version
13
16
  - gem --version
@@ -1,6 +1,13 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 5.4.0 (02 Oct 2017)
5
+
6
+ ### Enhancements
7
+
8
+ * Add a one-time warning if the API key is not set
9
+ * Track whether errors were captured automatically and by which middleware
10
+
4
11
  ## 5.3.3 (16 June 2017)
5
12
 
6
13
  * [Rails] Fix failure to report when encountering objects which throw in `to_s`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.3.3
1
+ 5.4.0
@@ -0,0 +1,18 @@
1
+ ### Expected behavior
2
+ *[Insert details on expected behaviour]*
3
+
4
+ ### Observed behavior
5
+ *[Insert details on observed behaviour]*
6
+
7
+ ### Steps to reproduce
8
+ *[Insert reproduction steps (if known)]*
9
+
10
+ ### Version
11
+ *[Insert version information]*
12
+
13
+ ### Additional information
14
+ *[Insert any additional information]*
15
+
16
+ #### Can't comment on Issues?
17
+ Some users have been unable to comment on Github issues when an [adblocker extension is enabled](https://docs.bugsnag.com/platforms/browsers/faq/#is-bugsnag-blocked-by-ad-blockers).
18
+ We recommend temporarily disabling the extension, or if that fails, contacting support@bugsnag.com.
@@ -24,6 +24,7 @@ require "bugsnag/middleware/sidekiq"
24
24
  require "bugsnag/middleware/mailman"
25
25
  require "bugsnag/middleware/rake"
26
26
  require "bugsnag/middleware/callbacks"
27
+ require "bugsnag/middleware/classify_error"
27
28
 
28
29
  module Bugsnag
29
30
  LOG_PREFIX = "** [Bugsnag] "
@@ -43,6 +44,17 @@ module Bugsnag
43
44
  # Use resque for asynchronous notification if required
44
45
  require "bugsnag/delay/resque" if configuration.delay_with_resque && defined?(Resque)
45
46
 
47
+ # Add info error classifier to internal middleware
48
+ configuration.internal_middleware.use(Bugsnag::Middleware::ClassifyError)
49
+
50
+ # Warn if an api_key hasn't been set
51
+ @key_warning = false unless defined?(@key_warning)
52
+
53
+ if !configuration.api_key && !@key_warning
54
+ warn "No API key has been set, check your configuration"
55
+ @key_warning = true
56
+ end
57
+
46
58
  # Log that we are ready to rock
47
59
  @logged_ready = false unless defined?(@logged_ready)
48
60
 
@@ -56,8 +68,19 @@ module Bugsnag
56
68
  def notify(exception, overrides=nil, request_data=nil, &block)
57
69
  notification = Notification.new(exception, configuration, overrides, request_data)
58
70
 
71
+ initial_severity = notification.severity
72
+ initial_reason = notification.severity_reason
73
+
59
74
  yield(notification) if block_given?
60
75
 
76
+ if notification.severity != initial_severity
77
+ notification.severity_reason = {
78
+ :type => Bugsnag::Notification::USER_CALLBACK_SET_SEVERITY
79
+ }
80
+ else
81
+ notification.severity_reason = initial_reason
82
+ end
83
+
61
84
  unless notification.ignore?
62
85
  notification.deliver
63
86
  notification
@@ -72,7 +95,8 @@ module Bugsnag
72
95
  # error class
73
96
  def auto_notify(exception, overrides=nil, request_data=nil, &block)
74
97
  overrides ||= {}
75
- overrides.merge!({:severity => "error"})
98
+ overrides[:severity] = "error" unless overrides.has_key? :severity
99
+ overrides[:unhandled] = true unless overrides.has_key? :unhandled
76
100
  notify_or_ignore(exception, overrides, request_data, &block) if configuration.auto_notify
77
101
  end
78
102
 
@@ -45,20 +45,6 @@ module Bugsnag
45
45
  "rack.request.form_vars"
46
46
  ].freeze
47
47
 
48
- DEFAULT_IGNORE_CLASSES = [
49
- "AbstractController::ActionNotFound",
50
- "ActionController::InvalidAuthenticityToken",
51
- "ActionController::ParameterMissing",
52
- "ActionController::UnknownAction",
53
- "ActionController::UnknownFormat",
54
- "ActionController::UnknownHttpMethod",
55
- "ActiveRecord::RecordNotFound",
56
- "CGI::Session::CookieStore::TamperedWithCookie",
57
- "Mongoid::Errors::DocumentNotFound",
58
- "SignalException",
59
- "SystemExit",
60
- ].freeze
61
-
62
48
  DEFAULT_IGNORE_USER_AGENTS = [].freeze
63
49
 
64
50
  DEFAULT_DELIVERY_METHOD = :thread_queue
@@ -72,7 +58,7 @@ module Bugsnag
72
58
  self.send_environment = false
73
59
  self.send_code = true
74
60
  self.params_filters = Set.new(DEFAULT_PARAMS_FILTERS)
75
- self.ignore_classes = Set.new(DEFAULT_IGNORE_CLASSES)
61
+ self.ignore_classes = Set.new()
76
62
  self.ignore_user_agents = Set.new(DEFAULT_IGNORE_USER_AGENTS)
77
63
  self.endpoint = DEFAULT_ENDPOINT
78
64
  self.hostname = default_hostname
@@ -17,6 +17,12 @@ unless defined? Delayed::Plugins::Bugsnag
17
17
  :job => {
18
18
  :class => job.class.name,
19
19
  :id => job.id,
20
+ },
21
+ :severity_reason => {
22
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
23
+ :attributes => {
24
+ :framework => "DelayedJob"
25
+ }
20
26
  }
21
27
  }
22
28
  if job.respond_to?(:queue) && (queue = job.queue)
@@ -15,7 +15,14 @@ module Bugsnag
15
15
  yield
16
16
  rescue Exception => ex
17
17
  raise ex if [Interrupt, SystemExit, SignalException].include? ex.class
18
- Bugsnag.auto_notify(ex)
18
+ Bugsnag.auto_notify(ex, {
19
+ :severity_reason => {
20
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
21
+ :attributes => {
22
+ :framework => "Mailman"
23
+ }
24
+ }
25
+ })
19
26
  raise
20
27
  ensure
21
28
  Bugsnag.clear_request_data
@@ -0,0 +1,53 @@
1
+ module Bugsnag::Middleware
2
+ class ClassifyError
3
+ INFO_CLASSES = [
4
+ "AbstractController::ActionNotFound",
5
+ "ActionController::InvalidAuthenticityToken",
6
+ "ActionController::ParameterMissing",
7
+ "ActionController::UnknownAction",
8
+ "ActionController::UnknownFormat",
9
+ "ActionController::UnknownHttpMethod",
10
+ "ActiveRecord::RecordNotFound",
11
+ "CGI::Session::CookieStore::TamperedWithCookie",
12
+ "Mongoid::Errors::DocumentNotFound",
13
+ "SignalException",
14
+ "SystemExit"
15
+ ]
16
+
17
+ def initialize(bugsnag)
18
+ @bugsnag = bugsnag
19
+ end
20
+
21
+ def call(notification)
22
+ notification.exceptions.each do |ex|
23
+
24
+ outer_break = false
25
+
26
+ ancestor_chain = ex.class.ancestors.select {
27
+ |ancestor| ancestor.is_a?(Class)
28
+ }.map {
29
+ |ancestor| ancestor.to_s
30
+ }
31
+
32
+ INFO_CLASSES.each do |info_class|
33
+ if ancestor_chain.include?(info_class)
34
+ notification.severity_reason = {
35
+ :type => Bugsnag::Notification::ERROR_CLASS,
36
+ :attributes => {
37
+ :errorClass => info_class
38
+ }
39
+ }
40
+ notification.severity = 'info'
41
+ outer_break = true
42
+ break
43
+ end
44
+ end
45
+
46
+ break if outer_break
47
+ end
48
+
49
+ @bugsnag.call(notification)
50
+ end
51
+ end
52
+ end
53
+
@@ -15,6 +15,13 @@ module Bugsnag
15
15
  NOTIFIER_VERSION = Bugsnag::VERSION
16
16
  NOTIFIER_URL = "http://www.bugsnag.com"
17
17
 
18
+ HANDLED_EXCEPTION = "handledException"
19
+ UNHANDLED_EXCEPTION = "unhandledException"
20
+ UNHANDLED_EXCEPTION_MIDDLEWARE = "unhandledExceptionMiddleware"
21
+ ERROR_CLASS = "errorClass"
22
+ USER_SPECIFIED_SEVERITY = "userSpecifiedSeverity"
23
+ USER_CALLBACK_SET_SEVERITY = "userCallbackSetSeverity"
24
+
18
25
  API_KEY_REGEX = /[0-9a-f]{32}/i
19
26
 
20
27
  # e.g. "org/jruby/RubyKernel.java:1264:in `catch'"
@@ -31,6 +38,8 @@ module Bugsnag
31
38
 
32
39
  attr_accessor :context
33
40
  attr_reader :user
41
+ attr_reader :severity
42
+ attr_accessor :severity_reason
34
43
  attr_accessor :configuration
35
44
  attr_accessor :meta_data
36
45
 
@@ -50,10 +59,36 @@ module Bugsnag
50
59
  @user = {}
51
60
  @should_ignore = false
52
61
  @severity = nil
62
+ @unhandled = false
63
+ @severity_reason = nil
53
64
  @grouping_hash = nil
54
65
  @delivery_method = nil
55
66
 
56
- self.severity = @overrides[:severity]
67
+ if @overrides.key? :unhandled
68
+ @unhandled = @overrides[:unhandled]
69
+ @overrides.delete :unhandled
70
+ end
71
+
72
+ valid_severity = @overrides.key?(:severity) && SUPPORTED_SEVERITIES.include?(@overrides[:severity])
73
+ has_reason = @overrides.key? :severity_reason
74
+
75
+ if valid_severity && has_reason
76
+ @severity = @overrides[:severity]
77
+ @severity_reason = @overrides[:severity_reason]
78
+ elsif valid_severity
79
+ @severity = @overrides[:severity]
80
+ @severity_reason = {
81
+ :type => USER_SPECIFIED_SEVERITY
82
+ }
83
+ elsif has_reason
84
+ @severity_reason = @overrides[:severity_reason]
85
+ else
86
+ @severity_reason = {
87
+ :type => HANDLED_EXCEPTION
88
+ }
89
+ end
90
+
91
+ @overrides.delete :severity_reason
57
92
  @overrides.delete :severity
58
93
 
59
94
  if @overrides.key? :grouping_hash
@@ -214,12 +249,19 @@ module Bugsnag
214
249
  # make meta_data available to public middleware
215
250
  @meta_data = generate_meta_data(@exceptions, @overrides)
216
251
 
252
+ initial_severity = self.severity
253
+
217
254
  # Run the middleware here (including Bugsnag::Middleware::Callbacks)
218
255
  # at the end of the middleware stack, execute the actual notification delivery
219
256
  @configuration.middleware.run(self) do
220
257
  # This supports self.ignore! for before_notify_callbacks.
221
258
  return if @should_ignore
222
259
 
260
+ # Check to see if the severity has been changed
261
+ if initial_severity != self.severity
262
+
263
+ end
264
+
223
265
  # Build the endpoint url
224
266
  endpoint = (@configuration.use_ssl ? "https://" : "http://") + @configuration.endpoint
225
267
  Bugsnag.log("Notifying #{endpoint} of #{@exceptions.last.class}")
@@ -243,6 +285,8 @@ module Bugsnag
243
285
  :payloadVersion => payload_version,
244
286
  :exceptions => exception_list,
245
287
  :severity => self.severity,
288
+ :unhandled => @unhandled,
289
+ :severityReason => @severity_reason,
246
290
  :groupingHash => self.grouping_hash,
247
291
  }
248
292
 
@@ -3,7 +3,14 @@ if defined?(::Que)
3
3
  begin
4
4
  job = job.dup # Make sure the original job object is not mutated.
5
5
 
6
- Bugsnag.auto_notify(error) do |notification|
6
+ Bugsnag.auto_notify(error, {
7
+ :severity_reason => {
8
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
9
+ :attributes => {
10
+ :framework => "Que"
11
+ }
12
+ }
13
+ }) do |notification|
7
14
  job[:error_count] += 1
8
15
 
9
16
  # If the job was scheduled using ActiveJob then unwrap the job details for clarity:
@@ -1,5 +1,13 @@
1
1
  module Bugsnag
2
2
  class Rack
3
+
4
+ SEVERITY_REASON = {
5
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
6
+ :attributes => {
7
+ :framework => "Rack"
8
+ }
9
+ }
10
+
3
11
  def initialize(app)
4
12
  @app = app
5
13
 
@@ -34,7 +42,9 @@ module Bugsnag
34
42
  response = @app.call(env)
35
43
  rescue Exception => raised
36
44
  # Notify bugsnag of rack exceptions
37
- Bugsnag.auto_notify(raised)
45
+ Bugsnag.auto_notify(raised, {
46
+ :severity_reason => SEVERITY_REASON
47
+ })
38
48
 
39
49
  # Re-raise the exception
40
50
  raise
@@ -42,7 +52,9 @@ module Bugsnag
42
52
 
43
53
  # Notify bugsnag of rack exceptions
44
54
  if env["rack.exception"]
45
- Bugsnag.auto_notify(env["rack.exception"])
55
+ Bugsnag.auto_notify(env["rack.exception"], {
56
+ :severity_reason => SEVERITY_REASON
57
+ })
46
58
  end
47
59
 
48
60
  response
@@ -1,6 +1,14 @@
1
1
  # Rails 2.x only
2
2
  module Bugsnag::Rails
3
3
  module ActionControllerRescue
4
+
5
+ SEVERITY_REASON = {
6
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
7
+ :attributes => {
8
+ :framework => "Rails"
9
+ }
10
+ }
11
+
4
12
  def self.included(base)
5
13
  base.extend(ClassMethods)
6
14
 
@@ -22,13 +30,17 @@ module Bugsnag::Rails
22
30
  end
23
31
 
24
32
  def rescue_action_in_public_with_bugsnag(exception)
25
- Bugsnag.auto_notify(exception)
33
+ Bugsnag.auto_notify(exception, {
34
+ :severity_reason => SEVERITY_REASON
35
+ })
26
36
 
27
37
  rescue_action_in_public_without_bugsnag(exception)
28
38
  end
29
39
 
30
40
  def rescue_action_locally_with_bugsnag(exception)
31
- Bugsnag.auto_notify(exception)
41
+ Bugsnag.auto_notify(exception, {
42
+ :severity_reason => SEVERITY_REASON
43
+ })
32
44
 
33
45
  rescue_action_locally_without_bugsnag(exception)
34
46
  end
@@ -8,7 +8,14 @@ module Bugsnag::Rails
8
8
  super
9
9
  rescue StandardError => exception
10
10
  # This exception will NOT be escalated, so notify it here.
11
- Bugsnag.auto_notify(exception)
11
+ Bugsnag.auto_notify(exception, {
12
+ :severity_reason => {
13
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
14
+ :attributes => {
15
+ :framework => "Rails"
16
+ }
17
+ }
18
+ })
12
19
  raise
13
20
  end
14
21
  else
@@ -17,7 +17,14 @@ module Bugsnag
17
17
  runner do
18
18
  at_exit do
19
19
  if $!
20
- Bugsnag.auto_notify($!)
20
+ Bugsnag.auto_notify($!, {
21
+ :severity_reason => {
22
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
23
+ :attributes => {
24
+ :framework => "Rails"
25
+ }
26
+ }
27
+ })
21
28
  end
22
29
  end
23
30
  end
@@ -12,7 +12,14 @@ class Rake::Task
12
12
  execute_without_bugsnag(args)
13
13
 
14
14
  rescue Exception => ex
15
- Bugsnag.auto_notify(ex)
15
+ Bugsnag.auto_notify(ex, {
16
+ :severity_reason => {
17
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
18
+ :attributes => {
19
+ :framework => "Rake"
20
+ }
21
+ }
22
+ })
16
23
  raise
17
24
  ensure
18
25
  Bugsnag.set_request_data :bugsnag_running_task, old_task
@@ -26,7 +26,16 @@ module Bugsnag
26
26
  end
27
27
 
28
28
  def save
29
- Bugsnag.auto_notify(exception, {:context => "#{payload['class']}@#{queue}", :payload => payload})
29
+ Bugsnag.auto_notify(exception, {
30
+ :context => "#{payload['class']}@#{queue}",
31
+ :payload => payload,
32
+ :severity_reason => {
33
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
34
+ :attributes => {
35
+ :framework => "Resque"
36
+ }
37
+ }
38
+ })
30
39
  end
31
40
  end
32
41
  end
@@ -18,7 +18,14 @@ module Bugsnag
18
18
 
19
19
  yield
20
20
  rescue Exception => ex
21
- Bugsnag.auto_notify(ex) unless [Interrupt, SystemExit, SignalException].include?(ex.class)
21
+ Bugsnag.auto_notify(ex, {
22
+ :severity_reason => {
23
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
24
+ :attributes => {
25
+ :framework => "Shoryuken"
26
+ }
27
+ }
28
+ }) unless [Interrupt, SystemExit, SignalException].include?(ex.class)
22
29
  raise
23
30
  ensure
24
31
  Bugsnag.clear_request_data
@@ -16,7 +16,14 @@ module Bugsnag
16
16
  yield
17
17
  rescue Exception => ex
18
18
  raise ex if [Interrupt, SystemExit, SignalException].include? ex.class
19
- Bugsnag.auto_notify(ex)
19
+ Bugsnag.auto_notify(ex, {
20
+ :severity_reason => {
21
+ :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
22
+ :attributes => {
23
+ :framework => "Sidekiq"
24
+ }
25
+ }
26
+ })
20
27
  raise
21
28
  ensure
22
29
  Bugsnag.clear_request_data
@@ -28,8 +28,10 @@ describe 'Bugsnag' do
28
28
  Dir.chdir(task_fixtures_path) do
29
29
  system("bundle exec rake test:crash > /dev/null 2>&1")
30
30
  end
31
- expect(request["events"][0]["metaData"]["rake_task"]).not_to be_nil
32
- expect(request["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash")
31
+
32
+ result = request()
33
+ expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil
34
+ expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash")
33
35
  end
34
36
 
35
37
  it 'should send notifications over the wire' do
@@ -113,6 +113,83 @@ describe Bugsnag::Notification do
113
113
  }
114
114
  end
115
115
 
116
+ it "uses correct unhandled defaults" do
117
+ Bugsnag.notify(BugsnagTestException.new("It crashed"))
118
+
119
+ expect(Bugsnag).to have_sent_notification{ |payload|
120
+ event = get_event_from_payload(payload)
121
+ expect(event["unhandled"]).to be false
122
+ expect(event["severity"]).to eq("warning")
123
+ expect(event["severityReason"]).to eq({
124
+ "type" => "handledException"
125
+ })
126
+ }
127
+ end
128
+
129
+ it "sets correct severityReason if severity is modified" do
130
+ Bugsnag.notify(BugsnagTestException.new("It crashed"), {:severity => "info"})
131
+
132
+ expect(Bugsnag).to have_sent_notification{ |payload|
133
+ event = get_event_from_payload(payload)
134
+ expect(event["unhandled"]).to be false
135
+ expect(event["severity"]).to eq("info")
136
+ expect(event["severityReason"]).to eq({
137
+ "type" => "userSpecifiedSeverity"
138
+ })
139
+ }
140
+ end
141
+
142
+ it "sets correct severityReason if severity is modified in a block" do
143
+ Bugsnag.notify(BugsnagTestException.new("It crashed")) do |notification|
144
+ notification.severity = "info"
145
+ end
146
+ expect(Bugsnag).to have_sent_notification{ |payload|
147
+ event = get_event_from_payload(payload)
148
+ expect(event["unhandled"]).to be false
149
+ expect(event["severity"]).to eq("info")
150
+ expect(event["severityReason"]).to eq({
151
+ "type" => "userCallbackSetSeverity"
152
+ })
153
+ }
154
+ end
155
+
156
+ it "sets unhandled and severityReasons through auto_notify" do
157
+ Bugsnag.auto_notify(BugsnagTestException.new("It crashed"), {
158
+ :severity_reason => {
159
+ :type => "unhandledExceptionMiddleware",
160
+ :attributes => {
161
+ :framework => "ruby test"
162
+ }
163
+ }
164
+ })
165
+ expect(Bugsnag).to have_sent_notification{ |payload|
166
+ event = get_event_from_payload(payload)
167
+ expect(event["unhandled"]).to be true
168
+ expect(event["severity"]).to eq("error")
169
+ expect(event["severityReason"]).to eq({
170
+ "type" => "unhandledExceptionMiddleware",
171
+ "attributes" => {
172
+ "framework" => "ruby test"
173
+ }
174
+ })
175
+ }
176
+ end
177
+
178
+ it "sets correct severity and reason for specific error classes" do
179
+ Bugsnag.notify(SignalException.new("TERM"))
180
+ expect(Bugsnag).to have_sent_notification{ |payload|
181
+ event = get_event_from_payload(payload)
182
+ expect(event["unhandled"]).to be false
183
+ expect(event["severity"]).to eq("info")
184
+ expect(event["severityReason"]).to eq({
185
+ "type" => "errorClass",
186
+ "attributes" => {
187
+ "errorClass" => "SignalException"
188
+ }
189
+ })
190
+ }
191
+ end
192
+
116
193
  # TODO: nested context
117
194
 
118
195
  it "accepts tabs in overrides and adds them to metaData" do
@@ -580,12 +657,6 @@ describe Bugsnag::Notification do
580
657
  }
581
658
  end
582
659
 
583
- it "does not notify if the exception class is in the default ignore_classes list" do
584
- Bugsnag.notify_or_ignore(ActiveRecord::RecordNotFound.new("It crashed"))
585
-
586
- expect(Bugsnag).not_to have_sent_notification
587
- end
588
-
589
660
  it "does not notify if the non-default exception class is added to the ignore_classes" do
590
661
  Bugsnag.configuration.ignore_classes << "BugsnagTestException"
591
662
 
@@ -32,6 +32,21 @@ describe Bugsnag::Rack do
32
32
 
33
33
  end
34
34
 
35
+ it "applies the correct severity reason" do
36
+ rack_stack.call(rack_env) rescue nil
37
+
38
+ expect(Bugsnag).to have_sent_notification{ |payload|
39
+ event = get_event_from_payload(payload)
40
+ expect(event["unhandled"]).to be true
41
+ expect(event["severityReason"]).to eq({
42
+ "type" => "unhandledExceptionMiddleware",
43
+ "attributes" => {
44
+ "framework" => "Rack"
45
+ }
46
+ })
47
+ }
48
+ end
49
+
35
50
  it "does not deliver an exception if auto_notify is disabled" do
36
51
  Bugsnag.configure do |config|
37
52
  config.auto_notify = false
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: 5.3.3
4
+ version: 5.4.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: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -115,6 +115,7 @@ files:
115
115
  - Rakefile
116
116
  - VERSION
117
117
  - bugsnag.gemspec
118
+ - issue_template.md
118
119
  - lib/bugsnag.rb
119
120
  - lib/bugsnag/capistrano.rb
120
121
  - lib/bugsnag/capistrano2.rb
@@ -130,6 +131,7 @@ files:
130
131
  - lib/bugsnag/mailman.rb
131
132
  - lib/bugsnag/meta_data.rb
132
133
  - lib/bugsnag/middleware/callbacks.rb
134
+ - lib/bugsnag/middleware/classify_error.rb
133
135
  - lib/bugsnag/middleware/clearance_user.rb
134
136
  - lib/bugsnag/middleware/mailman.rb
135
137
  - lib/bugsnag/middleware/rack_request.rb