lib/isolator/notifier.rb in isolator-0.1.0.pre2 vs lib/isolator/notifier.rb in isolator-0.1.0

- old
+ new

@@ -26,15 +26,19 @@ Isolator.config.send_notifications? end def log_exception return unless Isolator.config.logger - Isolator.config.logger.warn( - "[ISOLATOR EXCEPTION]\n" \ - "#{exception.message}\n" \ - " ↳ #{filtered_backtrace.first}" - ) + + offense_line = filtered_backtrace.first + + msg = "[ISOLATOR EXCEPTION]\n" \ + "#{exception.message}" + + msg += "\n ↳ #{offense_line}" if offense_line + + Isolator.config.logger.warn(msg) end def send_notifications return unless uniform_notifier_loaded? @@ -42,10 +46,10 @@ notifier.out_of_channel_notify exception.message end end def filtered_backtrace - backtrace.reject { |line| line =~ /gems/ }.take_while { |line| line !~ /ruby/ } + backtrace.reject { |line| line =~ /\/(gems|ruby)/ }.take_while { |line| line !~ /ruby/ } end def uniform_notifier_loaded? return true if defined?(::UniformNotifier)