diff options
Diffstat (limited to 'lib/rubygems/exceptions.rb')
-rw-r--r-- | lib/rubygems/exceptions.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb index 20e4049e48..1806869098 100644 --- a/lib/rubygems/exceptions.rb +++ b/lib/rubygems/exceptions.rb @@ -24,10 +24,14 @@ class Gem::UnknownCommandError < Gem::Exception return if defined?(@attached) if defined?(DidYouMean::SPELL_CHECKERS) && defined?(DidYouMean::Correctable) - DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] = - Gem::UnknownCommandSpellChecker + if DidYouMean.respond_to?(:correct_error) + DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker) + else + DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] = + Gem::UnknownCommandSpellChecker - prepend DidYouMean::Correctable + prepend DidYouMean::Correctable + end end @attached = true |