module Rafini::Exception

Public Instance Methods

puts(message=nil) click to toggle source

$!.puts outputs to standard error what went bang! The given message is what you normally want to see. The exeption message is also shown if in verbose mode. Backtrace is shown if in debug mode.

begin
  raise 'Ugly message'
rescue RuntimeError
  # exact output depends on $VERBOSE and $DEBUG
  $!.puts('Nice message')
end
# File lib/rafini/exception.rb, line 14
def puts(message=nil)
  unless $VERBOSE.nil? then
    $stderr.puts message if message
    $stderr.puts self.message if $VERBOSE or !message
    $stderr.puts self.backtrace.to_s if $DEBUG
  end
end