Writing

Abort instead of exit in Ruby

February 28, 2010 ·1 min read ·

Are you familiar with this code?

if error?
  puts "Sorry, error occured..."
  exit 1
end

Just replace that with:

abort "Sorry, error occured..." if error?

Simple and beautiful.

Edit on GitHub