Sha256: 6753065229a54ab59fae7c7c18696b9951a02c1c69a20c0b3db0a8b884243c05
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module ExceptionNotifier class CampfireNotifier < BaseNotifier attr_accessor :subdomain attr_accessor :token attr_accessor :room def initialize(options) super begin subdomain = options.delete(:subdomain) room_name = options.delete(:room_name) @campfire = Tinder::Campfire.new subdomain, options @room = @campfire.find_room_by_name room_name rescue @campfire = @room = nil end end def call(exception, options={}) if active? message = if options[:accumulated_errors_count].to_i > 1 "The exception occurred #{options[:accumulated_errors_count]} times: '#{exception.message}'" else "A new exception occurred: '#{exception.message}'" end message += " on '#{exception.backtrace.first}'" if exception.backtrace send_notice(exception, options, message) do |msg, _| @room.paste msg end end end private def active? !@room.nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
exception_notification-4.3.0 | lib/exception_notifier/campfire_notifier.rb |
exception_notification-4.2.2 | lib/exception_notifier/campfire_notifier.rb |