diff --git a/CHANGELOG.md b/CHANGELOG.md
index be53a6bef..4c416d366 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,23 @@
Changelog
=========
+## 6.15.0 (27 July 2020)
+
+### Enhancements
+
+* Add `on_error` callbacks to replace `before_notify_callbacks`
+ | [#608](https://github.com/bugsnag/bugsnag-ruby/pull/608)
+
+* Improve performance when extracting code from files in stacktraces
+ | [#604](https://github.com/bugsnag/bugsnag-ruby/pull/604)
+
+* Reduce memory use when session tracking is disabled
+ | [#606](https://github.com/bugsnag/bugsnag-ruby/pull/606)
+
+### Deprecated
+
+* `before_notify_callbacks` have been deprecated in favour of `on_error` and will be removed in the next major release
+
## 6.14.0 (20 July 2020)
### Enhancements
diff --git a/VERSION b/VERSION
index 68390495f..a3748c562 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.14.0
+6.15.0
diff --git a/example/padrino/app/app.rb b/example/padrino/app/app.rb
index 3630647ef..17ba9878b 100644
--- a/example/padrino/app/app.rb
+++ b/example/padrino/app/app.rb
@@ -75,21 +75,6 @@ class App < Padrino::Application
'bugsnag.com for a new notification!')
end
- get '/crash_with_callback' do
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Padrino demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
-
- msg = 'Bugsnag Padrino demo says: It crashed! But, due to the attached callback' +
- ' the exception has meta information. Go check' +
- ' bugsnag.com for a new notification (see the Diagnostics tab)!'
- raise RuntimeError.new(msg)
- end
-
get '/notify' do
Bugsnag.notify(RuntimeError.new("Bugsnag Padrino demo says: False alarm, your application didn't crash"))
@@ -100,21 +85,16 @@ class App < Padrino::Application
get '/notify_data' do
error = RuntimeError.new("Bugsnag Padrino demo says: False alarm, your application didn't crash")
- Bugsnag.notify error do |report|
- report.add_tab(:user, {
- :username => "bob-hoskins",
- :email => 'bugsnag@bugsnag.com',
- :registered_user => true
- })
+ Bugsnag.notify(error) do |report|
report.add_tab(:diagnostics, {
- :message => 'Padrino demo says: Everything is great',
- :code => 200
+ message: 'Padrino demo says: Everything is great',
+ code: 200
})
end
"Bugsnag Padrino demo says: It didn't crash! " +
'But still go check https://bugsnag.com' +
- ' for a new notification. Check out the User tab for the meta data'
+ ' for a new notification. Check out the Diagnostics tab for the meta data'
end
get '/notify_severity' do
diff --git a/example/padrino/app/templates/index.md b/example/padrino/app/templates/index.md
index 4f2d4be06..c2151a982 100644
--- a/example/padrino/app/templates/index.md
+++ b/example/padrino/app/templates/index.md
@@ -8,18 +8,14 @@ While testing the examples open [your dashboard](https://app.bugsnag.com) in ord
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify](/notify)
+2. [Notify](/notify)
Sends Bugsnag a report on demand using `bugsnag.notify`. Allows details of handled errors or information to be sent to the Bugsnag dashboard without crashing your code.
-4. [Notify with data](/notify_data)
+3. [Notify with data](/notify_data)
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the user to go into the `user` tab, and additional diagnostics as a `diagnostics` tab.
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding additional diagnostics as a `diagnostics` tab.
-5. [Set the severity](/notify_severity)
+4. [Set the severity](/notify_severity)
- This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
\ No newline at end of file
+ This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
diff --git a/example/padrino/config/boot.rb b/example/padrino/config/boot.rb
index 54e54347c..1af233fa7 100644
--- a/example/padrino/config/boot.rb
+++ b/example/padrino/config/boot.rb
@@ -38,6 +38,14 @@
Padrino.before_load do
Bugsnag.configure do |config|
config.api_key = 'YOUR_API_KEY'
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
end
diff --git a/example/rack/server.rb b/example/rack/server.rb
index c02887894..19674730e 100644
--- a/example/rack/server.rb
+++ b/example/rack/server.rb
@@ -5,9 +5,16 @@
require 'bugsnag'
require 'redcarpet'
-
Bugsnag.configure do |config|
config.api_key = 'YOUR_API_KEY'
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
class BugsnagDemo
@@ -18,19 +25,6 @@ def call(env)
when '/crash'
raise RuntimeError.new('Bugsnag Rack demo says: It crashed! Go check ' +
'bugsnag.com for a new notification!')
- when '/crash_with_callback'
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Rack demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
-
- msg = 'Bugsnag Rack demo says: It crashed! But, due to the attached callback' +
- ' the exception has meta information. Go check' +
- ' bugsnag.com for a new notification (see the Diagnostics tab)!'
- raise RuntimeError.new(msg)
when '/notify'
Bugsnag.notify(RuntimeError.new("Bugsnag Rack demo says: False alarm, your application didn't crash"))
@@ -39,21 +33,16 @@ def call(env)
' for a new notification.'
when '/notify_data'
error = RuntimeError.new("Bugsnag Rack demo says: False alarm, your application didn't crash")
- Bugsnag.notify error do |report|
- report.add_tab(:user, {
- :username => "bob-hoskins",
- :email => 'bugsnag@bugsnag.com',
- :registered_user => true
- })
+ Bugsnag.notify(error) do |report|
report.add_tab(:diagnostics, {
- :message => 'Rack demo says: Everything is great',
- :code => 200
+ message: 'Padrino demo says: Everything is great',
+ code: 200
})
end
text = "Bugsnag Rack demo says: It didn't crash! " +
'But still go check https://bugsnag.com' +
- ' for a new notification. Check out the User tab for the meta data'
+ ' for a new notification. Check out the Diagnostics tab for the meta data'
when '/notify_severity'
msg = "Bugsnag Rack demo says: Look at the circle on the right side. It's different"
error = RuntimeError.new(msg)
diff --git a/example/rack/templates/index.md b/example/rack/templates/index.md
index 52695efe2..6e111829b 100644
--- a/example/rack/templates/index.md
+++ b/example/rack/templates/index.md
@@ -8,18 +8,14 @@ While testing the examples open [your dashboard](https://app.bugsnag.com) in ord
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify](/notify)
+2. [Notify](/notify)
Sends Bugsnag a report on demand using `bugsnag.notify`. Allows details of handled errors or information to be sent to the Bugsnag dashboard without crashing your code.
-4. [Notify with data](/notify_data)
+3. [Notify with data](/notify_data)
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the user to go into the `user` tab, and additional diagnostics as a `diagnostics` tab.
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding additional diagnostics as a `diagnostics` tab.
-5. [Set the severity](/notify_severity)
+4. [Set the severity](/notify_severity)
- This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
\ No newline at end of file
+ This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
diff --git a/example/rails-42/app/controllers/application_controller.rb b/example/rails-42/app/controllers/application_controller.rb
index 33f2701ff..6d100c60f 100644
--- a/example/rails-42/app/controllers/application_controller.rb
+++ b/example/rails-42/app/controllers/application_controller.rb
@@ -10,19 +10,6 @@ def crash
'bugsnag.com for a new notification')
end
- def callback
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Rails v4.2 demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
- raise RuntimeError.new('Bugsnag Rails demo says: It crashed! But, due to the attached callback' +
- ' the exception has meta information. Go check' +
- ' bugsnag.com for a new notification (see the Diagnostics tab)!')
- end
-
def notify
Bugsnag.notify(RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash"))
@text = "Bugsnag Rack demo says: It didn't crash! " +
@@ -32,20 +19,15 @@ def notify
def data
error = RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash")
- Bugsnag.notify error do |report|
- report.add_tab(:user, {
- :username => "bob-hoskins",
- :email => 'bugsnag@bugsnag.com',
- :registered_user => true
- })
+ Bugsnag.notify(error) do |report|
report.add_tab(:diagnostics, {
- :message => 'Rails demo says: Everything is great',
- :code => 200
+ message: 'Rails demo says: Everything is great',
+ code: 200
})
end
@text = "Bugsnag Rails demo says: It didn't crash! " +
'But still go check https://bugsnag.com' +
- ' for a new notification. Check out the User tab for the meta data'
+ ' for a new notification. Check out the Diagnostics tab for the meta data'
end
def severity
diff --git a/example/rails-42/app/views/index.md b/example/rails-42/app/views/index.md
index 4b37c029c..5595a3980 100644
--- a/example/rails-42/app/views/index.md
+++ b/example/rails-42/app/views/index.md
@@ -8,18 +8,14 @@ While testing the examples open [your dashboard](https://app.bugsnag.com) in ord
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify](/notify)
+2. [Notify](/notify)
Sends Bugsnag a report on demand using `bugsnag.notify`. Allows details of handled errors or information to be sent to the Bugsnag dashboard without crashing your code.
-4. [Notify with data](/notify_data)
+3. [Notify with data](/notify_data)
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the user to go into the `user` tab, and additional diagnostics as a `diagnostics` tab.
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding additional diagnostics as a `diagnostics` tab.
-5. [Set the severity](/notify_severity)
+4. [Set the severity](/notify_severity)
- This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
\ No newline at end of file
+ This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
diff --git a/example/rails-42/config/initializers/bugsnag.rb b/example/rails-42/config/initializers/bugsnag.rb
index 58c57fbf6..2b02bc66a 100644
--- a/example/rails-42/config/initializers/bugsnag.rb
+++ b/example/rails-42/config/initializers/bugsnag.rb
@@ -1,3 +1,11 @@
Bugsnag.configure do |config|
config.api_key = "YOUR_API_KEY_HERE"
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
diff --git a/example/rails-42/config/routes.rb b/example/rails-42/config/routes.rb
index 9a3a1b9f0..70fe670cc 100644
--- a/example/rails-42/config/routes.rb
+++ b/example/rails-42/config/routes.rb
@@ -1,10 +1,8 @@
Rails.application.routes.draw do
root :to => 'application#index'
-
+
get 'crash' => 'application#crash'
- get 'crash_with_callback' => 'application#callback'
get 'notify' => 'application#notify'
get 'notify_data' => 'application#data'
get 'notify_severity' => 'application#severity'
-
end
diff --git a/example/rails-51/README.md b/example/rails-51/README.md
index f4bd52f94..f3bf4fbca 100644
--- a/example/rails-51/README.md
+++ b/example/rails-51/README.md
@@ -132,5 +132,5 @@ Navigate to the `/resque` page and queue any of the examples using links provide
To process the queues, run the `resque:work` task as stated in the example webpage. In order to process any of the queues on a single thread start the resque worker using the command:
```shell
-QUEUE=crash,callback,metadata bundle exec rake resque:work
-```
\ No newline at end of file
+QUEUE=crash,metadata bundle exec rake resque:work
+```
diff --git a/example/rails-51/app/controllers/application_controller.rb b/example/rails-51/app/controllers/application_controller.rb
index 33f2701ff..6d100c60f 100644
--- a/example/rails-51/app/controllers/application_controller.rb
+++ b/example/rails-51/app/controllers/application_controller.rb
@@ -10,19 +10,6 @@ def crash
'bugsnag.com for a new notification')
end
- def callback
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Rails v4.2 demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
- raise RuntimeError.new('Bugsnag Rails demo says: It crashed! But, due to the attached callback' +
- ' the exception has meta information. Go check' +
- ' bugsnag.com for a new notification (see the Diagnostics tab)!')
- end
-
def notify
Bugsnag.notify(RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash"))
@text = "Bugsnag Rack demo says: It didn't crash! " +
@@ -32,20 +19,15 @@ def notify
def data
error = RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash")
- Bugsnag.notify error do |report|
- report.add_tab(:user, {
- :username => "bob-hoskins",
- :email => 'bugsnag@bugsnag.com',
- :registered_user => true
- })
+ Bugsnag.notify(error) do |report|
report.add_tab(:diagnostics, {
- :message => 'Rails demo says: Everything is great',
- :code => 200
+ message: 'Rails demo says: Everything is great',
+ code: 200
})
end
@text = "Bugsnag Rails demo says: It didn't crash! " +
'But still go check https://bugsnag.com' +
- ' for a new notification. Check out the User tab for the meta data'
+ ' for a new notification. Check out the Diagnostics tab for the meta data'
end
def severity
diff --git a/example/rails-51/app/controllers/que_controller.rb b/example/rails-51/app/controllers/que_controller.rb
index a8de7ceb2..5b3db72b1 100644
--- a/example/rails-51/app/controllers/que_controller.rb
+++ b/example/rails-51/app/controllers/que_controller.rb
@@ -11,9 +11,4 @@ def crash
QueCrash.enqueue
@text = "Que has queued the crash task"
end
-
- def callbacks
- QueCallback.enqueue
- @text = "Que has queued the callbacks task"
- end
end
diff --git a/example/rails-51/app/controllers/resque_controller.rb b/example/rails-51/app/controllers/resque_controller.rb
index c0eb75595..420a13fb1 100644
--- a/example/rails-51/app/controllers/resque_controller.rb
+++ b/example/rails-51/app/controllers/resque_controller.rb
@@ -16,9 +16,4 @@ def metadata
Resque.enqueue(ResqueWorkers::Metadata)
@text = "The metadata task has been queued. This can be run using the `QUEUE=metadata bundle exec rake resque:work` command"
end
-
- def callbacks
- Resque.enqueue(ResqueWorkers::Callback)
- @text = "The callback task has been queued. This can be run using the `QUEUE=callback bundle exec rake resque:work` command"
- end
end
diff --git a/example/rails-51/app/controllers/sidekiq_controller.rb b/example/rails-51/app/controllers/sidekiq_controller.rb
index 2b814ab82..2e1ee5fa7 100644
--- a/example/rails-51/app/controllers/sidekiq_controller.rb
+++ b/example/rails-51/app/controllers/sidekiq_controller.rb
@@ -17,9 +17,4 @@ def metadata
@text = "Sidekiq is performing a task that will notify an error with some metadata without crashing.
Check out your dashboard!"
end
-
- def callbacks
- SidekiqWorkers::CallbackWorker.perform_async
- @text = "Sidekiq is performing a task that will crash, but registers a callback before this to attach additional metadata."
- end
end
diff --git a/example/rails-51/app/jobs/que_callback.rb b/example/rails-51/app/jobs/que_callback.rb
deleted file mode 100644
index 55032c9d0..000000000
--- a/example/rails-51/app/jobs/que_callback.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class QueCallback < Que::Job
- @run_at = proc { 5.seconds.from_now }
-
- def run(options={})
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Que demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
- raise "Oh no"
- end
-end
diff --git a/example/rails-51/app/views/index.md b/example/rails-51/app/views/index.md
index 5edbc9eb5..0f2db4363 100644
--- a/example/rails-51/app/views/index.md
+++ b/example/rails-51/app/views/index.md
@@ -14,18 +14,14 @@ While testing the examples open [your dashboard](https://app.bugsnag.com) in ord
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify](/notify)
+2. [Notify](/notify)
Sends Bugsnag a report on demand using `bugsnag.notify`. Allows details of handled errors or information to be sent to the Bugsnag dashboard without crashing your code.
-4. [Notify with data](/notify_data)
+3. [Notify with data](/notify_data)
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the user to go into the `user` tab, and additional diagnostics as a `diagnostics` tab.
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding additional diagnostics as a `diagnostics` tab.
-5. [Set the severity](/notify_severity)
+4. [Set the severity](/notify_severity)
- This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
\ No newline at end of file
+ This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
diff --git a/example/rails-51/app/views/que.md b/example/rails-51/app/views/que.md
index 6272fd7b8..805bcb185 100644
--- a/example/rails-51/app/views/que.md
+++ b/example/rails-51/app/views/que.md
@@ -9,7 +9,3 @@ Make sure you have a PostgreSQL instance running that your test application can
1. [Crash](/que/crash)
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-
-2. [Crash and use callbacks](/que/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
\ No newline at end of file
diff --git a/example/rails-51/app/views/que/callbacks.html.erb b/example/rails-51/app/views/que/callbacks.html.erb
deleted file mode 100644
index aa2786a7d..000000000
--- a/example/rails-51/app/views/que/callbacks.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= markdown(@text)%>
\ No newline at end of file
diff --git a/example/rails-51/app/views/resque.md b/example/rails-51/app/views/resque.md
index b4ed7b0a3..221a821a3 100644
--- a/example/rails-51/app/views/resque.md
+++ b/example/rails-51/app/views/resque.md
@@ -9,17 +9,13 @@ Make sure you have a Redis instance running that your test application can conne
While each queue can be run individually, to run Resque so that it automatically executes each task, use:
```shell
-QUEUE=crash,callback,metadata bundle exec rake resque:work
+QUEUE=crash,metadata bundle exec rake resque:work
```
1. [Crash](/resque/crash)
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/resque/crash_with_callback)
+2. [Notify with data](/resque/notify_data)
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify with data](/resque/notify_data)
-
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the queue to go into the `queue` tab, and additional diagnostics as a `diagnostics` tab.
\ No newline at end of file
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding information about the queue to go into the `queue` tab, and additional diagnostics as a `diagnostics` tab.
diff --git a/example/rails-51/app/views/resque/callbacks.html.erb b/example/rails-51/app/views/resque/callbacks.html.erb
deleted file mode 100644
index aa2786a7d..000000000
--- a/example/rails-51/app/views/resque/callbacks.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= markdown(@text)%>
\ No newline at end of file
diff --git a/example/rails-51/app/views/sidekiq.md b/example/rails-51/app/views/sidekiq.md
index 65edd291b..ace8f64ac 100644
--- a/example/rails-51/app/views/sidekiq.md
+++ b/example/rails-51/app/views/sidekiq.md
@@ -10,10 +10,6 @@ Make sure you have a Redis instance running that your test application can conne
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/sidekiq/crash_with_callback)
+2. [Notify with data](/sidekiq/notify_data)
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify with data](/sidekiq/notify_data)
-
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the function being called to go into the `function` tab, and additional diagnostics as a `diagnostics` tab.
\ No newline at end of file
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding information about the function being called to go into the `function` tab, and additional diagnostics as a `diagnostics` tab.
diff --git a/example/rails-51/app/views/sidekiq/callbacks.html.erb b/example/rails-51/app/views/sidekiq/callbacks.html.erb
deleted file mode 100644
index aa2786a7d..000000000
--- a/example/rails-51/app/views/sidekiq/callbacks.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= markdown(@text)%>
\ No newline at end of file
diff --git a/example/rails-51/app/workers/resque_workers.rb b/example/rails-51/app/workers/resque_workers.rb
index 327a5984e..9891db8bc 100644
--- a/example/rails-51/app/workers/resque_workers.rb
+++ b/example/rails-51/app/workers/resque_workers.rb
@@ -7,22 +7,6 @@ def self.perform
end
end
- # Unhandled with callback Exception example
- class Callback
- @queue = :callback
-
- def self.perform
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Resque demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
- raise Exception.new "Crashed - Check the Bugsnag dashboard for diagnostic data"
- end
- end
-
# Handled example with additional data
class Metadata
@queue = :metadata
@@ -41,4 +25,4 @@ def self.perform
puts "The Resque worker hasn't crashed, but it has sent a notification, with additional data to the dashboard"
end
end
-end
\ No newline at end of file
+end
diff --git a/example/rails-51/app/workers/sidekiq_workers.rb b/example/rails-51/app/workers/sidekiq_workers.rb
index 3aa06d2ce..8ced0c6a8 100644
--- a/example/rails-51/app/workers/sidekiq_workers.rb
+++ b/example/rails-51/app/workers/sidekiq_workers.rb
@@ -1,20 +1,4 @@
module SidekiqWorkers
- class CallbackWorker
- include Sidekiq::Worker
- sidekiq_options :retry => false
-
- def perform
- Bugsnag.before_notify_callbacks << proc { |report|
- new_tab = {
- message: 'Sidekiq demo says: Everything is great',
- code: 200
- }
- report.add_tab(:diagnostics, new_tab)
- }
- raise Exception.new "Sidekiq crashed, but the callback added metadata - Check your Bugsnag dashboard"
- end
- end
-
class CrashWorker
include Sidekiq::Worker
sidekiq_options :retry => false
diff --git a/example/rails-51/config/initializers/bugsnag.rb b/example/rails-51/config/initializers/bugsnag.rb
index 58c57fbf6..2b02bc66a 100644
--- a/example/rails-51/config/initializers/bugsnag.rb
+++ b/example/rails-51/config/initializers/bugsnag.rb
@@ -1,3 +1,11 @@
Bugsnag.configure do |config|
config.api_key = "YOUR_API_KEY_HERE"
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
diff --git a/example/rails-51/config/routes.rb b/example/rails-51/config/routes.rb
index 1bb035f6a..bdee80b99 100644
--- a/example/rails-51/config/routes.rb
+++ b/example/rails-51/config/routes.rb
@@ -2,7 +2,6 @@
# Vanilla rails routing
get '/', to: 'application#index'
get '/crash', to: 'application#crash'
- get '/crash_with_callback', to: 'application#callback'
get '/notify', to: 'application#notify'
get '/notify_data', to: 'application#data'
get '/notify_severity', to: 'application#severity'
@@ -11,16 +10,13 @@
get '/sidekiq', to: 'sidekiq#index'
get '/sidekiq/crash', to: 'sidekiq#crash'
get '/sidekiq/notify_data', to: 'sidekiq#metadata'
- get '/sidekiq/crash_with_callback', to: 'sidekiq#callbacks'
# Que routing
get '/que', to: 'que#index'
get '/que/crash', to: 'que#crash'
get '/que/notify_data', to: 'que#metadata'
- get '/que/crash_with_callback', to: 'que#callbacks'
# Resque routing
get '/resque', to: 'resque#index'
get '/resque/crash', to: 'resque#crash'
- get '/resque/crash_with_callback', to: 'resque#callbacks'
end
diff --git a/example/rails-60/README.md b/example/rails-60/README.md
index 2eaa10f01..86b66e508 100644
--- a/example/rails-60/README.md
+++ b/example/rails-60/README.md
@@ -133,5 +133,5 @@ Navigate to the `/resque` page and queue any of the examples using links provide
To process the queues, run the `resque:work` task as stated in the example webpage. In order to process any of the queues on a single thread start the resque worker using the command:
```shell
-QUEUE=crash,callback,metadata bundle exec rake resque:work
+QUEUE=crash,metadata bundle exec rake resque:work
```
diff --git a/example/rails-60/app/controllers/application_controller.rb b/example/rails-60/app/controllers/application_controller.rb
index 4be69567f..1f7a9f073 100644
--- a/example/rails-60/app/controllers/application_controller.rb
+++ b/example/rails-60/app/controllers/application_controller.rb
@@ -4,19 +4,6 @@ def crash
'Go check bugsnag.com for a new notification'
end
- def callback
- Bugsnag.before_notify_callbacks << proc { |report|
- report.add_tab(:diagnostics, {
- message: 'Rails v6.0 demo says: Everything is great',
- code: 200
- })
- }
-
- raise 'Bugsnag Rails demo says: It crashed! But, due to the attached callback' \
- 'the exception has meta information. Go check ' \
- 'bugsnag.com for a new notification (see the Diagnostics tab)!'
- end
-
def notify
Bugsnag.notify(RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash"))
end
@@ -25,12 +12,6 @@ def data
error = RuntimeError.new("Bugsnag Rails demo says: False alarm, your application didn't crash")
Bugsnag.notify(error) do |report|
- report.add_tab(:user, {
- username: 'bob-hoskins',
- email: 'bugsnag@bugsnag.com',
- registered_user: true
- })
-
report.add_tab(:diagnostics, {
message: 'Rails demo says: Everything is great',
code: 200
diff --git a/example/rails-60/app/controllers/que_controller.rb b/example/rails-60/app/controllers/que_controller.rb
index eb7529196..00400cce5 100644
--- a/example/rails-60/app/controllers/que_controller.rb
+++ b/example/rails-60/app/controllers/que_controller.rb
@@ -1,5 +1,4 @@
require './app/jobs/que_crash'
-require './app/jobs/que_callback'
class QueController < ActionController::Base
layout "application"
@@ -7,8 +6,4 @@ class QueController < ActionController::Base
def crash
QueCrash.enqueue
end
-
- def callbacks
- QueCallback.enqueue
- end
end
diff --git a/example/rails-60/app/controllers/resque_controller.rb b/example/rails-60/app/controllers/resque_controller.rb
index 2bdea9196..8dc1d2534 100644
--- a/example/rails-60/app/controllers/resque_controller.rb
+++ b/example/rails-60/app/controllers/resque_controller.rb
@@ -8,8 +8,4 @@ def crash
def metadata
Resque.enqueue(ResqueWorkers::Metadata)
end
-
- def callbacks
- Resque.enqueue(ResqueWorkers::Callback)
- end
end
diff --git a/example/rails-60/app/controllers/sidekiq_controller.rb b/example/rails-60/app/controllers/sidekiq_controller.rb
index b925be414..80135f81c 100644
--- a/example/rails-60/app/controllers/sidekiq_controller.rb
+++ b/example/rails-60/app/controllers/sidekiq_controller.rb
@@ -10,8 +10,4 @@ def crash
def metadata
SidekiqWorkers::MetadataWorker.perform_async
end
-
- def callbacks
- SidekiqWorkers::CallbackWorker.perform_async
- end
end
diff --git a/example/rails-60/app/jobs/que_callback.rb b/example/rails-60/app/jobs/que_callback.rb
deleted file mode 100644
index 34efe9a48..000000000
--- a/example/rails-60/app/jobs/que_callback.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class QueCallback < Que::Job
- @run_at = proc { 5.seconds.from_now }
-
- def run(_options = {})
- Bugsnag.before_notify_callbacks << proc { |report|
- report.add_tab(:diagnostics, {
- message: 'Que demo says: Everything is great',
- code: 200
- })
- }
-
- raise 'Oh no!'
- end
-end
diff --git a/example/rails-60/app/views/application/data.html.erb b/example/rails-60/app/views/application/data.html.erb
index 3c050280e..e79a6e076 100644
--- a/example/rails-60/app/views/application/data.html.erb
+++ b/example/rails-60/app/views/application/data.html.erb
@@ -5,6 +5,6 @@
for a new notification.
Check out the user
tab to see the metadata.
Check out the diagnostics
tab to see the metadata.
- Raises an exception within the framework, but with additional data - attached to the report. By registering a callback before the error - occurs useful data can be attached as a tab in the Bugsnag dashboard. -
-@@ -45,12 +36,10 @@
Same as notify
but allows you to attach additional data
- within a block
, similar to the
- before_notify_callbacks
example above.
+ within a block
.
- In this case we're adding information about the user to go into the
- user
tab, and additional diagnostics as a
+ In this case we're adding additional diagnostics as a
diagnostics
tab.
- Que has queued the callbacks task, check - your Bugsnag dashboard for the result! -
- - diff --git a/example/rails-60/app/views/que/index.html.erb b/example/rails-60/app/views/que/index.html.erb index 2568880cc..f22da5a78 100644 --- a/example/rails-60/app/views/que/index.html.erb +++ b/example/rails-60/app/views/que/index.html.erb @@ -22,20 +22,6 @@ Bugsnag dashboard. - -- Raises an exception within the framework, but with additional data - attached to the report. -
- -- By registering a callback before the error occurs useful data can - be attached as a tab in the Bugsnag dashboard. -
-- The callback task has been queued. -
- -- This can be executed by running: -
- -QUEUE=callback bundle exec rake resque:work- -
- Check your Bugsnag dashboard for the result! -
- - diff --git a/example/rails-60/app/views/resque/index.html.erb b/example/rails-60/app/views/resque/index.html.erb index 7f5e4d763..483e94910 100644 --- a/example/rails-60/app/views/resque/index.html.erb +++ b/example/rails-60/app/views/resque/index.html.erb @@ -1,6 +1,6 @@ -This route demonstrates how to use Bugsnag with Rescue.
+This route demonstrates how to use Bugsnag with Resque.
While testing the examples open @@ -18,7 +18,7 @@ automatically executes each task, use:
-QUEUE=crash,callback,metadata bundle exec rake resque:work+
QUEUE=crash,metadata bundle exec rake resque:work
- Raises an exception within the framework, but with additional data - attached to the report. -
- -- By registering a callback before the error occurs useful data can - be attached as a tab in the Bugsnag dashboard. -
-
Same as notify
but allows you to attach additional data
- within a block
, similar to the
- "crash and use callbacks" example above.
+ within a block
.
diff --git a/example/rails-60/app/views/sidekiq/callbacks.html.erb b/example/rails-60/app/views/sidekiq/callbacks.html.erb deleted file mode 100644 index 14bb48406..000000000 --- a/example/rails-60/app/views/sidekiq/callbacks.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
- Sidekiq is performing a task that will crash, but registers a callback - before this to attach additional metadata. -
- -- Check your Bugsnag dashboard for the result! -
- - diff --git a/example/rails-60/app/views/sidekiq/index.html.erb b/example/rails-60/app/views/sidekiq/index.html.erb index 110b6746c..79313d0f3 100644 --- a/example/rails-60/app/views/sidekiq/index.html.erb +++ b/example/rails-60/app/views/sidekiq/index.html.erb @@ -20,23 +20,12 @@Raises an error within the framework, generating a report in the Bugsnag dashboard.
- Raises an exception within the framework, but with additional data - attached to the report. By registering a callback before the error - occurs useful data can be attached as a tab in the Bugsnag dashboard. -
-
Sends Bugsnag a report on demand using bugsnag.notify
- and attaches additional data within a block
, similar to
- the "Crash and use callbacks" example above. In this case we're
+ and attaches additional data within a block
. In this case we're
adding information about the function being called to go into the
function
tab, and additional diagnostics
as a diagnostics
tab.
diff --git a/example/rails-60/app/workers/resque_workers.rb b/example/rails-60/app/workers/resque_workers.rb
index 1b0feee35..055cc1ad0 100644
--- a/example/rails-60/app/workers/resque_workers.rb
+++ b/example/rails-60/app/workers/resque_workers.rb
@@ -7,22 +7,6 @@ def self.perform
end
end
- # Unhandled with callback Exception example
- class Callback
- @queue = :callback
-
- def self.perform
- Bugsnag.before_notify_callbacks << proc { |report|
- report.add_tab(:diagnostics, {
- message: 'Resque demo says: Everything is great',
- code: 200
- })
- }
-
- raise 'Crashed - Check the Bugsnag dashboard for diagnostic data'
- end
- end
-
# Handled example with additional data
class Metadata
@queue = :metadata
diff --git a/example/rails-60/app/workers/sidekiq_workers.rb b/example/rails-60/app/workers/sidekiq_workers.rb
index 59bfddef1..7e78ed17b 100644
--- a/example/rails-60/app/workers/sidekiq_workers.rb
+++ b/example/rails-60/app/workers/sidekiq_workers.rb
@@ -1,21 +1,4 @@
module SidekiqWorkers
- class CallbackWorker
- include Sidekiq::Worker
-
- sidekiq_options :retry => false
-
- def perform
- Bugsnag.before_notify_callbacks << proc { |report|
- report.add_tab(:diagnostics, {
- message: 'Sidekiq demo says: Everything is great',
- code: 200
- })
- }
-
- raise 'Sidekiq crashed, but the callback added metadata - Check your Bugsnag dashboard'
- end
- end
-
class CrashWorker
include Sidekiq::Worker
sidekiq_options :retry => false
diff --git a/example/rails-60/config/initializers/bugsnag.rb b/example/rails-60/config/initializers/bugsnag.rb
index 58c57fbf6..2b02bc66a 100644
--- a/example/rails-60/config/initializers/bugsnag.rb
+++ b/example/rails-60/config/initializers/bugsnag.rb
@@ -1,3 +1,11 @@
Bugsnag.configure do |config|
config.api_key = "YOUR_API_KEY_HERE"
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
diff --git a/example/rails-60/config/routes.rb b/example/rails-60/config/routes.rb
index b5f1747c3..8e1e16d07 100644
--- a/example/rails-60/config/routes.rb
+++ b/example/rails-60/config/routes.rb
@@ -2,7 +2,6 @@
# Vanilla rails routing
get '/', to: 'application#index'
get '/crash', to: 'application#crash'
- get '/crash_with_callback', to: 'application#callback'
get '/notify', to: 'application#notify'
get '/notify_data', to: 'application#data'
get '/notify_severity', to: 'application#severity'
@@ -11,17 +10,14 @@
get '/sidekiq', to: 'sidekiq#index'
get '/sidekiq/crash', to: 'sidekiq#crash'
get '/sidekiq/notify_data', to: 'sidekiq#metadata'
- get '/sidekiq/crash_with_callback', to: 'sidekiq#callbacks'
# Que routing
get '/que', to: 'que#index'
get '/que/crash', to: 'que#crash'
get '/que/notify_data', to: 'que#metadata'
- get '/que/crash_with_callback', to: 'que#callbacks'
# Resque routing
get '/resque', to: 'resque#index'
get '/resque/crash', to: 'resque#crash'
- get '/resque/crash_with_callback', to: 'resque#callbacks'
get '/resque/notify_data', to: 'resque#metadata'
end
diff --git a/example/rails-60/tmp/.keep b/example/rails-60/tmp/.keep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/example/rails-60/tmp/pids/.keep b/example/rails-60/tmp/pids/.keep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/example/sinatra/config.ru b/example/sinatra/config.ru
index 68efa300b..da677dabb 100644
--- a/example/sinatra/config.ru
+++ b/example/sinatra/config.ru
@@ -8,6 +8,14 @@ set :show_exceptions, false
Bugsnag.configure do |config|
config.api_key = 'YOUR_API_KEY'
+
+ config.add_on_error(proc do |report|
+ report.add_tab(:user, {
+ username: 'bob-hoskins',
+ email: 'bugsnag@bugsnag.com',
+ registered_user: true
+ })
+ end)
end
get '/' do
@@ -23,21 +31,6 @@ get '/crash' do
'bugsnag.com for a new notification!')
end
-get '/crash_with_callback' do
- Bugsnag.before_notify_callbacks << proc { |notification|
- new_tab = {
- message: 'Sinatra demo says: Everything is great',
- code: 200
- }
- notification.add_tab(:diagnostics, new_tab)
- }
-
- msg = 'Bugsnag Sinatra demo says: It crashed! But, due to the attached callback' +
- ' the exception has meta information. Go check' +
- ' bugsnag.com for a new notification (see the Diagnostics tab)!'
- raise RuntimeError.new(msg)
-end
-
get '/notify' do
Bugsnag.notify(RuntimeError.new("Bugsnag Sinatra demo says: False alarm, your application didn't crash"))
@@ -48,21 +41,16 @@ end
get '/notify_data' do
error = RuntimeError.new("Bugsnag Sinatra demo says: False alarm, your application didn't crash")
- Bugsnag.notify error do |report|
- report.add_tab(:user, {
- :username => "bob-hoskins",
- :email => 'bugsnag@bugsnag.com',
- :registered_user => true
- })
+ Bugsnag.notify(error) do |report|
report.add_tab(:diagnostics, {
- :message => 'Sinatra demo says: Everything is great',
- :code => 200
+ message: 'Sinatra demo says: Everything is great',
+ code: 200
})
end
"Bugsnag Sinatra demo says: It didn't crash! " +
'But still go check https://bugsnag.com' +
- ' for a new notification. Check out the User tab for the meta data'
+ ' for a new notification. Check out the Diagnostics tab for the meta data'
end
get '/notify_severity' do
diff --git a/example/sinatra/templates/index.md b/example/sinatra/templates/index.md
index 52695efe2..6e111829b 100644
--- a/example/sinatra/templates/index.md
+++ b/example/sinatra/templates/index.md
@@ -8,18 +8,14 @@ While testing the examples open [your dashboard](https://app.bugsnag.com) in ord
Raises an error within the framework, generating a report in the Bugsnag dashboard.
-2. [Crash and use callbacks](/crash_with_callback)
-
- Raises an exception within the framework, but with additional data attached to the report. By registering a callback before the error occurs useful data can be attached as a tab in the Bugsnag dashboard.
-
-3. [Notify](/notify)
+2. [Notify](/notify)
Sends Bugsnag a report on demand using `bugsnag.notify`. Allows details of handled errors or information to be sent to the Bugsnag dashboard without crashing your code.
-4. [Notify with data](/notify_data)
+3. [Notify with data](/notify_data)
- Same as `notify` but allows you to attach additional data within a `block`, similar to the `before_notify_callbacks` example above. In this case we're adding information about the user to go into the `user` tab, and additional diagnostics as a `diagnostics` tab.
+ Same as `notify` but allows you to attach additional data within a `block`. In this case we're adding additional diagnostics as a `diagnostics` tab.
-5. [Set the severity](/notify_severity)
+4. [Set the severity](/notify_severity)
- This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
\ No newline at end of file
+ This uses the same mechanism as adding meta-data, but allows you to set he `severity` when notifying Bugsnag of the error. Valid severities are `error`, `warning`, and `info`. Have a look on the dashboard to see the difference in these severities.
diff --git a/features/fixtures/docker-compose.yml b/features/fixtures/docker-compose.yml
index 3352a421a..0357d5fb5 100644
--- a/features/fixtures/docker-compose.yml
+++ b/features/fixtures/docker-compose.yml
@@ -120,6 +120,7 @@ services:
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
+ - ADD_ON_ERROR
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
restart: "no"
@@ -155,6 +156,7 @@ services:
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
+ - ADD_ON_ERROR
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
restart: "no"
@@ -190,6 +192,7 @@ services:
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
+ - ADD_ON_ERROR
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
restart: "no"
@@ -225,6 +228,7 @@ services:
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
+ - ADD_ON_ERROR
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
restart: "no"
networks:
@@ -296,4 +300,4 @@ services:
networks:
default:
- name: ${NETWORK_NAME}
\ No newline at end of file
+ name: ${NETWORK_NAME}
diff --git a/features/fixtures/plain/app/report_modification/initiators/handled_on_error.rb b/features/fixtures/plain/app/report_modification/initiators/handled_on_error.rb
new file mode 100644
index 000000000..16e8af4d2
--- /dev/null
+++ b/features/fixtures/plain/app/report_modification/initiators/handled_on_error.rb
@@ -0,0 +1,10 @@
+require 'bugsnag'
+require './app'
+
+configure_basics
+
+def run(callback)
+ Bugsnag.add_on_error(callback)
+
+ Bugsnag.notify(RuntimeError.new("Oh no"))
+end
diff --git a/features/fixtures/plain/app/report_modification/initiators/unhandled_on_error.rb b/features/fixtures/plain/app/report_modification/initiators/unhandled_on_error.rb
new file mode 100644
index 000000000..0b949961c
--- /dev/null
+++ b/features/fixtures/plain/app/report_modification/initiators/unhandled_on_error.rb
@@ -0,0 +1,11 @@
+require 'bugsnag'
+require './app'
+
+configure_basics
+add_at_exit
+
+def run(callback)
+ Bugsnag.add_on_error(callback)
+
+ raise RuntimeError.new "Oh no"
+end
diff --git a/features/fixtures/plain/app/stack_frame_modification/initiators/handled_on_error.rb b/features/fixtures/plain/app/stack_frame_modification/initiators/handled_on_error.rb
new file mode 100644
index 000000000..012c6fca8
--- /dev/null
+++ b/features/fixtures/plain/app/stack_frame_modification/initiators/handled_on_error.rb
@@ -0,0 +1,29 @@
+require 'bugsnag'
+require './app'
+
+configure_basics
+
+def run(callback)
+ Bugsnag.add_on_error(callback)
+ step_one
+end
+
+def step_one
+ step_two
+end
+
+def step_two
+ step_three
+end
+
+def step_three
+ crash
+end
+
+def crash
+ begin
+ "Test".insrt(-1, "!")
+ rescue Exception => e
+ Bugsnag.notify(e)
+ end
+end
diff --git a/features/fixtures/plain/app/stack_frame_modification/initiators/unhandled_on_error.rb b/features/fixtures/plain/app/stack_frame_modification/initiators/unhandled_on_error.rb
new file mode 100644
index 000000000..7f323503c
--- /dev/null
+++ b/features/fixtures/plain/app/stack_frame_modification/initiators/unhandled_on_error.rb
@@ -0,0 +1,26 @@
+require 'bugsnag'
+require './app'
+
+configure_basics
+add_at_exit
+
+def run(callback)
+ Bugsnag.add_on_error(callback)
+ step_one
+end
+
+def step_one
+ step_two
+end
+
+def step_two
+ step_three
+end
+
+def step_three
+ crash
+end
+
+def crash
+ raise RuntimeError.new "Oh no"
+end
diff --git a/features/fixtures/rails3/app/config/initializers/bugsnag.rb b/features/fixtures/rails3/app/config/initializers/bugsnag.rb
index b849c0995..8a1ac08ea 100644
--- a/features/fixtures/rails3/app/config/initializers/bugsnag.rb
+++ b/features/fixtures/rails3/app/config/initializers/bugsnag.rb
@@ -18,4 +18,12 @@
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
end
end
+
+ if ENV["ADD_ON_ERROR"] == "true"
+ config.add_on_error(proc do |report|
+ report.add_tab(:on_error, {
+ source: report.unhandled ? 'on_error unhandled' : 'on_error handled'
+ })
+ end)
+ end
end
diff --git a/features/fixtures/rails4/app/config/initializers/bugsnag.rb b/features/fixtures/rails4/app/config/initializers/bugsnag.rb
index b849c0995..8a1ac08ea 100644
--- a/features/fixtures/rails4/app/config/initializers/bugsnag.rb
+++ b/features/fixtures/rails4/app/config/initializers/bugsnag.rb
@@ -18,4 +18,12 @@
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
end
end
+
+ if ENV["ADD_ON_ERROR"] == "true"
+ config.add_on_error(proc do |report|
+ report.add_tab(:on_error, {
+ source: report.unhandled ? 'on_error unhandled' : 'on_error handled'
+ })
+ end)
+ end
end
diff --git a/features/fixtures/rails5/app/config/initializers/bugsnag.rb b/features/fixtures/rails5/app/config/initializers/bugsnag.rb
index b849c0995..8a1ac08ea 100644
--- a/features/fixtures/rails5/app/config/initializers/bugsnag.rb
+++ b/features/fixtures/rails5/app/config/initializers/bugsnag.rb
@@ -18,4 +18,12 @@
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
end
end
+
+ if ENV["ADD_ON_ERROR"] == "true"
+ config.add_on_error(proc do |report|
+ report.add_tab(:on_error, {
+ source: report.unhandled ? 'on_error unhandled' : 'on_error handled'
+ })
+ end)
+ end
end
diff --git a/features/fixtures/rails6/app/config/initializers/bugsnag.rb b/features/fixtures/rails6/app/config/initializers/bugsnag.rb
index b849c0995..8a1ac08ea 100644
--- a/features/fixtures/rails6/app/config/initializers/bugsnag.rb
+++ b/features/fixtures/rails6/app/config/initializers/bugsnag.rb
@@ -18,4 +18,12 @@
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
end
end
+
+ if ENV["ADD_ON_ERROR"] == "true"
+ config.add_on_error(proc do |report|
+ report.add_tab(:on_error, {
+ source: report.unhandled ? 'on_error unhandled' : 'on_error handled'
+ })
+ end)
+ end
end
diff --git a/features/plain_features/add_tab.feature b/features/plain_features/add_tab.feature
index 6dd380a9e..6e2218b8a 100644
--- a/features/plain_features/add_tab.feature
+++ b/features/plain_features/add_tab.feature
@@ -15,6 +15,8 @@ Scenario Outline: Metadata can be added to a report using add_tab
| handled_before_notify |
| handled_block |
| unhandled_before_notify |
+ | handled_on_error |
+ | unhandled_on_error |
Scenario Outline: Metadata can be added to an existing tab using add_tab
Given I set environment variable "CALLBACK_INITIATOR" to "