Class: TingYun::Agent::Transaction::Exceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/ting_yun/agent/transaction/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExceptions

Returns a new instance of Exceptions.



9
10
11
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 9

def initialize
  @exceptions = {}
end

Instance Attribute Details

#exceptionsObject

Returns the value of attribute exceptions.



7
8
9
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 7

def exceptions
  @exceptions
end

Instance Method Details

#had_error?Boolean

collector error

Returns:

  • (Boolean)


32
33
34
35
36
37
38
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 32

def had_error?
  if @exceptions.empty?
    return false
  else
    return true
  end
end

#notice_error(error, options = {}) ⇒ Object

Do not call this. Invoke the class method instead.



23
24
25
26
27
28
29
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 23

def notice_error(error, options={}) # :nodoc:
  if @exceptions[error]
    @exceptions[error].merge! options
  else
    @exceptions[error] = options
  end
end

#record_exceptions(attributes) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 13

def record_exceptions(attributes)
  unless @exceptions.empty?
    @exceptions.each do |exception, options|
      options[:attributes]      = attributes
      ::TingYun::Agent.instance.error_collector.notice_error(exception, options)
    end
  end
end