[ruby-core:97012] [Ruby master Bug#16599] did_you_mean is not activated for NameError and KeyError

From: sawadatsuyoshi@...
Date: 2020-01-28 20:26:24 UTC
List: ruby-core #97012
Issue #16599 has been reported by sawa (Tsuyoshi Sawada).

----------------------------------------
Bug #16599: did_you_mean is not activated for NameError and KeyError
https://bugs.ruby-lang.org/issues/16599

* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6, 2.7, perhaps for earlier versions too
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
[This document](https://www.rubydoc.info/gems/did_you_mean/) claims that the did_you_mean gem responds to NameError, NoMethodError, and KeyError, but it actually seems to only respond to NoMethodError.

```ruby
foo()
# >> NoMethodError: undefined method `foo' for main:Object
# >> Did you mean?  for

foo
# >> NameError: undefined local variable or method `foo' for main:Object

Foo
# >> NameError: uninitialized constant Foo

{foo: 1}.fetch(:bar)
# >> KeyError: key not found: :bar
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next