Skip to content

Commit

Permalink
Update 'undefined local variable' error message
Browse files Browse the repository at this point in the history
Ruby 3.3 changes the format slightly

Ruby <3.3:
> undefined local variable or method `generate_unhandled_error' for #<BeforeNotifyController

Ruby 3.3:
> undefined local variable or method `generate_unhandled_error' for an instance of BeforeNotifyController
  • Loading branch information
imjoehaines committed Jan 4, 2024
1 parent ae1d518 commit 9c149da
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion features/rails_features/before_notify.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Scenario: Rails before_notify controller method works on unhandled errors
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<BeforeNotifyController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )BeforeNotifyController"
And the event "unhandled" is true
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/before_notify/unhandled"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/handled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Scenario: Thrown handled NameError
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<HandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )HandledController"
And the event "unhandled" is false
And the event "metaData.request.url" ends with "/handled/thrown"
And the event "app.type" equals "rails"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/on_error.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Scenario: Rails on_error works on unhandled errors
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "unhandled" is true
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/unhandled/error"
Expand Down
4 changes: 2 additions & 2 deletions features/rails_features/request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Scenario: Request data is collected automatically
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
Expand All @@ -33,7 +33,7 @@ Scenario: Request data can be modified in callbacks
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.something" equals "hello"
And the event "metaData.request.params.another_thing" equals "hi"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/unhandled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Scenario: Unhandled RuntimeError
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/unhandled/error"
And the event "severity" equals "error"
Expand Down

0 comments on commit 9c149da

Please sign in to comment.