Correct some erreoneous information about ruby execption handling. #91

Merged
merged 1 commit into from Apr 6, 2012

Conversation

Projects
None yet
2 participants

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 
Sam Goldstein Correct some errors regarding `rescue Exception`
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.
1b0fd8f

@bbatsov bbatsov added a commit that referenced this pull request Apr 6, 2012

@bbatsov bbatsov Merge pull request #91 from samg/master
Correct some erreoneous information about ruby execption handling.
f9e8dd6

@bbatsov bbatsov merged commit f9e8dd6 into bbatsov:master Apr 6, 2012

Owner

bbatsov commented Apr 6, 2012

Thanks!

@marocchino marocchino pushed a commit to marocchino/ruby-style-guide that referenced this pull request Aug 11, 2015

@bbatsov bbatsov Merge pull request #91 from samg/master
Correct some erreoneous information about ruby execption handling.
a981261

@shyouhei shyouhei pushed a commit to shyouhei/ruby-style-guide that referenced this pull request Nov 11, 2015

@bbatsov bbatsov Merge pull request #91 from samg/master
Correct some erreoneous information about ruby execption handling.
d116a3c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment