Method: Object#show_errors

Defined in:
lib/util/ruby_extensions.rb

#show_errors(&block) ⇒ Object

if block raises an exception outputs the error message. returns block’s exit value or reraises the exception



122
123
124
125
126
127
128
129
# File 'lib/util/ruby_extensions.rb', line 122

def show_errors(&block)
  begin
    block.call
  rescue Exception => e
    puts "Exception '#{e.message}':\n#{e.backtrace.join("\n")}"
    raise
  end
end