Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ RuntimeError.exception fails #1452

Closed
kyrylo opened this issue Jul 22, 2015 · 1 comment
Closed

$ RuntimeError.exception fails #1452

kyrylo opened this issue Jul 22, 2015 · 1 comment
Labels

Comments

@kyrylo
Copy link
Member

kyrylo commented Jul 22, 2015

[7] pry(main)> $ RuntimeError.exception                                                                                                                                                           
NoMethodError: undefined method `each_with_index' for nil:NilClass
from /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/code.rb:91:in `initialize'
[7] pry(main)> wtf
Exception: NoMethodError: undefined method `each_with_index' for nil:NilClass
--
0: /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/code.rb:91:in `initialize'
1: /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/commands/show_source.rb:42:in `new'
2: /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/commands/show_source.rb:42:in `content_for'
3: /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/commands/show_info.rb:106:in `header'
4: /home/kyrylo/.gem/ruby/2.2.2/gems/pry-0.10.1/lib/pry/commands/show_info.rb:75:in `content_and_header_for_code_object'

NOTE: show-doc works fine.

@kyrylo kyrylo added the bug label Jul 22, 2015
@egwspiti
Copy link
Contributor

[1] pry(main)> YARD::Registry.at("Exception.exception").source
=> nil
[2] pry(main)> YARD::Registry.at("Exception.exception").docstring
=> "call-seq:\n   exc.exception(string)  ->  an_exception or exc\n\nWith no argument, or if the argument is the same as the receiver,\nreturn the receiver. Otherwise, create a new\nexception object of the same class as the receiver, but with a\nmessage equal to <code>string.to_str</code>."

I think Pry wrongly assumes that if a docstring can be located, a source can be located too.

kyrylo added a commit that referenced this issue Oct 3, 2018
Fixes #1452.
($ RuntimeError.exception fails)

Alternative to #1453.
kyrylo added a commit that referenced this issue Oct 3, 2018
Fixes #1452.
($ RuntimeError.exception fails)

Alternative to #1453.
kyrylo added a commit that referenced this issue Oct 3, 2018
Fixes #1452.
($ RuntimeError.exception fails)

Alternative to #1453.
kyrylo added a commit that referenced this issue Oct 3, 2018
Fixes #1452.
($ RuntimeError.exception fails)

Alternative to #1453.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants