-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
Problem
I was wondering if Warning.process(/foo/) { :raise }
is explicitly supported as it works only if no prior calls to Warning.process
has been made.
Consider this code:
require 'warning'
Warning.process(/foo/) { :raise } # This works?
Warning.process(/bar/) { :raise }
# => ArgumentError (comparison of Regexp with Regexp failed)
The first argument of Warning.process must be a path and actions can be passed as a Hash:
require 'warning'
Warning.process('', /foo/ => :raise)
Warning.process('', /bar/ => :raise)
warn("foo") # => RuntimeError (foo)
warn("bar") # => RuntimeError (bar)
Proposed solution
Make Warning.process(/foo/) { :raise }
always fail.
Happy to create a PR if the proposed solution is accepted 💪
Refs
Refs https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91789
Metadata
Metadata
Assignees
Labels
No labels