Sha256: fc7b3c2dbf25511a5269b509ae56b32069ccef5dd0203706f55d914700b85fd4
Contents?: true
Size: 777 Bytes
Versions: 3
Compression:
Stored size: 777 Bytes
Contents
module Rumx module Beans class TimerAndError < Timer bean_attr_reader :error_count, :integer, 'Number of times the measured block has raised an exception' bean_attr_reader :errors, :list, 'List of the last occurring errors', :list_type => :bean def initialize(opts={}) super @error_count = 0 @errors = [] @max_errors = (opts[:max_errors] || 1).to_i end def measure super rescue Exception => e bean_synchronize do @error_count += 1 @errors << Message.new(e.message) @errors.shift while @errors.size > @max_errors end raise end def to_s "error_count=#{@error_count}" + super end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rumx-0.1.5 | lib/rumx/beans/timer_and_error.rb |
rumx-0.1.4 | lib/rumx/beans/timer_and_error.rb |
rumx-0.1.3 | lib/rumx/beans/timer_and_error.rb |