-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
642 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
features/fixtures/rails8/app/app/controllers/active_job_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class ActiveJobController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def handled | ||
NotifyJob.perform_later(1, "hello", { a: "a", b: "b" }, keyword: true) | ||
|
||
render json: {} | ||
end | ||
|
||
def unhandled | ||
UnhandledJob.perform_later(123, { abc: "xyz" }, "abcxyz") | ||
|
||
render json: {} | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
features/fixtures/rails8/app/app/controllers/api_key_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class ApiKeyController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def environment | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def changing | ||
Bugsnag.configure do |conf| | ||
conf.api_key = params[:api_key] | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
27 changes: 27 additions & 0 deletions
27
features/fixtures/rails8/app/app/controllers/app_type_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class AppTypeController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def handled | ||
raise "Handled error" | ||
rescue StandardError => e | ||
Bugsnag.notify(e) | ||
render json: {} | ||
end | ||
|
||
def unhandled | ||
raise "Unhandled error" | ||
end | ||
|
||
def initializer | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.app_type = params[:type] | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
features/fixtures/rails8/app/app/controllers/app_version_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class AppVersionController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def default | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def initializer | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.app_version = params[:version] | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
27 changes: 27 additions & 0 deletions
27
features/fixtures/rails8/app/app/controllers/auto_notify_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class AutoNotifyController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def unhandled | ||
generate_unhandled_error | ||
end | ||
|
||
def handled | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def unhandled_after | ||
Bugsnag.configure do |conf| | ||
conf.auto_notify = false | ||
end | ||
generate_unhandled_error | ||
end | ||
|
||
def handled_after | ||
Bugsnag.configure do |conf| | ||
conf.auto_notify = false | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
40 changes: 40 additions & 0 deletions
40
features/fixtures/rails8/app/app/controllers/before_notify_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class BeforeNotifyController < ActionController::Base | ||
protect_from_forgery | ||
before_bugsnag_notify :add_diagnostics_to_bugsnag | ||
|
||
def handled | ||
Bugsnag.before_notify_callbacks << Proc.new do |report| | ||
report.add_tab(:before_notify, { | ||
:source => "rails_before_handled" | ||
}) | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def unhandled | ||
Bugsnag.before_notify_callbacks << Proc.new do |report| | ||
report.add_tab(:before_notify, { | ||
:source => "rails_before_unhandled" | ||
}) | ||
end | ||
generate_unhandled_error | ||
end | ||
|
||
def inline | ||
Bugsnag.notify("handled string") do |report| | ||
report.add_tab(:before_notify, { | ||
:source => "rails_inline" | ||
}) | ||
end | ||
render json: {} | ||
end | ||
|
||
private | ||
|
||
def add_diagnostics_to_bugsnag(report) | ||
report.add_tab(:controller, { | ||
:name => "BeforeNotifyController" | ||
}) | ||
end | ||
end |
24 changes: 24 additions & 0 deletions
24
features/fixtures/rails8/app/app/controllers/breadcrumbs_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class BreadcrumbsController < ApplicationController | ||
def handled | ||
Bugsnag.notify("Request breadcrumb") | ||
render json: {} | ||
end | ||
|
||
def sql_breadcrumb | ||
User.find_by(email: "foo") | ||
Bugsnag.notify("SQL breadcrumb") | ||
render json: {} | ||
end | ||
|
||
def active_job | ||
NotifyJob.perform_later | ||
render json: {} | ||
end | ||
|
||
def cache_read | ||
Rails.cache.write('test', true) | ||
Rails.cache.read('test') | ||
Bugsnag.notify("Cache breadcrumb") | ||
render json: {} | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
features/fixtures/rails8/app/app/controllers/clearance_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class ClearanceController < Clearance::BaseController | ||
protect_from_forgery | ||
def create | ||
user = User.find_by(:email => "[email protected]") | ||
User.new({ | ||
:email => "[email protected]", | ||
:name => "Clearance User", | ||
:first_name => "Clearance", | ||
:last_name => "User", | ||
:password => "Password" | ||
}).save if user.nil? | ||
render json: {} | ||
end | ||
|
||
def unhandled | ||
user = User.find_by(:email => "[email protected]") | ||
unless user.nil? | ||
@current_user = user | ||
cookies['remember_token'] = user.remember_token | ||
end | ||
generate_unhandled_error | ||
end | ||
|
||
def handled | ||
user = User.find_by(:email => "[email protected]") | ||
unless user.nil? | ||
@current_user = user | ||
cookies['remember_token'] = user.remember_token | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
features/fixtures/rails8/app/app/controllers/feature_flags_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class FeatureFlagsController < ActionController::Base | ||
protect_from_forgery | ||
|
||
before_bugsnag_notify :add_feature_flags | ||
|
||
def unhandled | ||
Bugsnag.add_feature_flag('unhandled') | ||
|
||
raise 'oh no' | ||
end | ||
|
||
def handled | ||
Bugsnag.add_feature_flag('handled') | ||
|
||
Bugsnag.notify(RuntimeError.new('ahhh')) | ||
end | ||
|
||
private | ||
|
||
def add_feature_flags(event) | ||
params['flags'].each do |key, value| | ||
event.add_feature_flag(key, value) | ||
end | ||
|
||
if params.key?('clear_all_flags') | ||
event.add_metadata(:clear_all_flags, :a, 1) | ||
else | ||
event.clear_feature_flag('should be removed!') | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
features/fixtures/rails8/app/app/controllers/handled_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class HandledController < ActionController::Base | ||
protect_from_forgery with: :exception | ||
|
||
def unthrown | ||
Bugsnag.notify(RuntimeError.new("handled unthrown error")) | ||
render json: {} | ||
end | ||
|
||
def thrown | ||
begin | ||
generate_unhandled_error | ||
rescue Exception => e | ||
Bugsnag.notify(e) | ||
end | ||
render json: {} | ||
end | ||
|
||
def string_notify | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
features/fixtures/rails8/app/app/controllers/ignore_classes_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class IgnoredError < RuntimeError | ||
end | ||
|
||
class IgnoreClassesController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def initializer | ||
Bugsnag.notify(IgnoredError.new) | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.ignore_classes << Kernel.const_get(params[:ignore]) | ||
end | ||
Bugsnag.notify(IgnoredError.new) | ||
render json: {} | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
features/fixtures/rails8/app/app/controllers/metadata_filters_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class MetadataFiltersController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def filter | ||
Bugsnag.notify("handled string") do |report| | ||
report.add_tab(:my_specific_filter, { | ||
:foo => "bar" | ||
}) | ||
end | ||
render json: {} | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
features/fixtures/rails8/app/app/controllers/mongo_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class MongoController < ApplicationController | ||
def success_crash | ||
doc = MongoModel.create(string_field: "String") | ||
doc.save | ||
"Statement".prepnd("Failing") | ||
end | ||
|
||
def get_crash | ||
MongoModel.where(string_field: true).as_json | ||
MongoModel.any_of({string_field: true}, {numeric_field: 123}).as_json | ||
"Statement".prepnd("Failing") | ||
end | ||
|
||
def failure_crash | ||
begin | ||
Mongoid::Clients.default.database.command(:bogus => 1) | ||
rescue | ||
end | ||
|
||
"Statement".prepnd("Failing") | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
features/fixtures/rails8/app/app/controllers/project_root_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class ProjectRootController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def default | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def initializer | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.project_root = '/test/root/here' | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
features/fixtures/rails8/app/app/controllers/release_stage_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class ReleaseStageController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def default | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.release_stage = params[:stage] | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
features/fixtures/rails8/app/app/controllers/send_code_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class SendCodeController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def initializer | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
|
||
def after | ||
Bugsnag.configure do |conf| | ||
conf.send_code = false | ||
end | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
features/fixtures/rails8/app/app/controllers/send_environment_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class SendEnvironmentController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def initializer | ||
Bugsnag.notify("handled string") | ||
render json: {} | ||
end | ||
end |
Oops, something went wrong.