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

Correct some erreoneous information about ruby execption handling. #91

Merged
merged 1 commit into from Apr 6, 2012

Conversation

samg
Copy link

@samg samg commented Apr 6, 2012

begin; rescue Exception; end

is not the same as

begin: rescue; end # this rescues from StandardError, not Exception

This former is a bad practice which results in processes that don't
respond to kill and other signals. It's rarely what's intended.

Try this one for fun:

begin
  # calls to exit and kill signals will be caught (except kill -9)
  exit
rescue Exception
  puts "you didn't really want to exit, right?"
  # exception handling
end 

begin; rescue Exception; end

is not the same as

begin: rescue; end

This former is a bad practice which results in processes that don't
respond to `kill` and other signals.  It's rarely what's intended.
bbatsov added a commit that referenced this pull request Apr 6, 2012
Correct some erreoneous information about ruby execption handling.
@bbatsov bbatsov merged commit f9e8dd6 into rubocop:master Apr 6, 2012
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 6, 2012

Thanks!

marocchino pushed a commit to marocchino/ruby-style-guide that referenced this pull request Aug 11, 2015
Correct some erreoneous information about ruby execption handling.
shyouhei pushed a commit to shyouhei/ruby-style-guide that referenced this pull request Nov 11, 2015
Correct some erreoneous information about ruby execption handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants