# File lib/rake.rb, line 2067
2067:     def standard_exception_handling
2068:       begin
2069:         yield
2070:       rescue SystemExit => ex
2071:         # Exit silently with current status
2072:         raise
2073:       rescue OptionParser::InvalidOption => ex
2074:         # Exit silently
2075:         exit(false)
2076:       rescue Exception => ex
2077:         # Exit with error message
2078:         $stderr.puts "#{name} aborted!"
2079:         $stderr.puts ex.message
2080:         if options.trace
2081:           $stderr.puts ex.backtrace.join("\n")
2082:         else
2083:           $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
2084:           $stderr.puts "(See full trace by running task with --trace)"
2085:         end
2086:         exit(false)
2087:       end
2088:     end