class Regexp::Scanner::ValidationError

def self.for(type, problem, reason = nil)

Centralizes and unifies the handling of validation related errors.
def self.for(type, problem, reason = nil)
  types.fetch(type).new(problem, reason)
end