Skip to content

Commit

Permalink
Tweak exception message added in previous commit
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
jeremyevans committed Jul 5, 2022
1 parent 9ca8f6a commit b775e11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=== master

* Raise ArgumentError if Warning.process is passed non-String as first argument (splattael) (#17, #19)

=== 1.2.1 (2021-10-04)

* Recognize additional void context warnings (kachick) (#13)
Expand Down
2 changes: 1 addition & 1 deletion lib/warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def ignore(regexp, path='')
# Warning.process(__FILE__, :missing_ivar=>:backtrace, :keyword_separation=>:raise)
def process(path='', actions=nil, &block)
unless path.is_a?(String)
raise ArgumentError, "path must be a String not a #{path.class}"
raise ArgumentError, "path must be a String (given an instance of #{path.class})"
end

if block
Expand Down
2 changes: 1 addition & 1 deletion test/test_warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def test_warning_process_path_no_string
e = assert_raises(ArgumentError) do
Warning.process(/foo/) { :raise }
end
assert_includes(e.message, "path must be a String not a Regexp")
assert_includes(e.message, "path must be a String (given an instance of Regexp)")
end

if RUBY_VERSION >= '3.0'
Expand Down

0 comments on commit b775e11

Please sign in to comment.