class SidekiqRemappableErrors::ErrorMatcher
Attributes
klass[R]
regex[R]
Public Class Methods
new(config)
click to toggle source
# File lib/sidekiq_remappable_errors/error_matcher.rb, line 5 def initialize(config) validate_config!(config) @klass = config[0] @regex = config[1] end
Public Instance Methods
match?(error)
click to toggle source
# File lib/sidekiq_remappable_errors/error_matcher.rb, line 14 def match?(error) @klass.to_s == error.class.to_s && error.message.match(@regex) end
Private Instance Methods
valid_config?(config)
click to toggle source
# File lib/sidekiq_remappable_errors/error_matcher.rb, line 27 def valid_config?(config) config.is_a?(Array) && config[0] <= Exception && config[1].is_a?(Regexp) end
validate_config!(config)
click to toggle source
# File lib/sidekiq_remappable_errors/error_matcher.rb, line 20 def validate_config!(config) return if valid_config?(config) raise InvalidErrorMatcherError, "Invalid remappable error definition #{config}. Expected [error class, regex]." end