Skip to content

Commit

Permalink
Clearer deprecation message on error
Browse files Browse the repository at this point in the history
  • Loading branch information
noelrappin committed Dec 15, 2023
1 parent 9b3593e commit 3e5d56c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.6.1 Dec 15, 2023

* Warning Signs error message makes it clearer that Warning Signs is
triggering the error

## 0.6.0

* Allow for format options in messages
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
warning_signs (0.6.0)
warning_signs (0.6.1)
awesome_print
railties (<= 7.1.0)

Expand Down
2 changes: 0 additions & 2 deletions lib/warning_signs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ module WarningSigns
SAMPLE_CONSTANT = "foobar"

class InvalidHandlerError < StandardError; end

class UnhandledDeprecationError < StandardError; end
end

loader.eager_load
9 changes: 9 additions & 0 deletions lib/warning_signs/unhandled_deprecation_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module WarningSigns
class UnhandledDeprecationError < StandardError
MESSAGE = "This error was raised by the Warning Signs gem in response to a deprecation warning in Ruby or Rails. If this warning is not causing problems, you can add it to the exceptions list in .warning_signs.yml."

def message
super + "\n\n" + MESSAGE
end
end
end
2 changes: 1 addition & 1 deletion lib/warning_signs/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WarningSigns
VERSION = "0.6.0"
VERSION = "0.6.1"
end
8 changes: 8 additions & 0 deletions spec/warning_signs/unhandled_deprecation_error_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module WarningSigns
RSpec.describe UnhandledDeprecationError do
it "handles warnings" do
exe = UnhandledDeprecationError.new("Feature x is going away")
expect(exe.message.ends_with?("exceptions list in .warning_signs.yml.")).to be_truthy
end
end
end

0 comments on commit 3e5d56c

Please sign in to comment.