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

DidYouMean::Correctable can cause NoMethodErrors to become undumpable #108

Closed
jessebs opened this issue Aug 3, 2018 · 0 comments
Closed
Labels

Comments

@jessebs
Copy link

jessebs commented Aug 3, 2018

The following code fails on Marshal.dump because the receiver set in DidYouMean::MethodNameChecker is not dumpable (it's an IO object)

def test_dump_exception
  File.open('/tmp/file').sizee
rescue NoMethodError => e
  e.to_s
  puts 'before'
  Marshal.dump(e)
  puts 'after'
end

If I remove the e.to_s line, the dump works fine. This is because MethodNameChecker is instantiated as part of Correctable.to_s, which sets the receiver.

One proposal is to remove the receiver while dumping. A better solution is to do whatever ruby does with the receiver while dumping NameError (the parent of NoMethodError)

@yuki24 yuki24 added the Bug label Nov 19, 2018
@yuki24 yuki24 closed this as completed in 86fa28e Dec 18, 2018
yuki24 added a commit that referenced this issue Mar 9, 2019
yuki24 added a commit that referenced this issue Mar 9, 2019
yuki24 added a commit that referenced this issue Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants