Class: TingYun::Agent::Transaction::Exceptions
- Inherits:
-
Object
- Object
- TingYun::Agent::Transaction::Exceptions
- Defined in:
- lib/ting_yun/agent/transaction/exceptions.rb
Instance Attribute Summary collapse
-
#exceptions ⇒ Object
Returns the value of attribute exceptions.
Instance Method Summary collapse
- #count_errors ⇒ Object
- #errors ⇒ Object
- #errors_and_exceptions ⇒ Object
-
#had_error? ⇒ Boolean
collector error.
-
#initialize ⇒ Exceptions
constructor
A new instance of Exceptions.
-
#notice_error(error, options = {}) ⇒ Object
Do not call this.
- #record_exceptions(attributes) ⇒ Object
Constructor Details
#initialize ⇒ Exceptions
Returns a new instance of Exceptions.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 10 def initialize @exceptions = {} end |
Instance Attribute Details
#exceptions ⇒ Object
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
#count_errors ⇒ Object
41 42 43 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 41 def count_errors @count_errors ||= errors.size end |
#errors ⇒ Object
45 46 47 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 45 def errors @errors ||= exceptions.select{|k,v| v[:type]==:error} end |
#errors_and_exceptions ⇒ Object
37 38 39 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 37 def errors_and_exceptions [count_errors, exceptions.size - count_errors] end |
#had_error? ⇒ Boolean
collector error
33 34 35 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 33 def had_error? @have ||= count_errors == 0? false : true end |
#notice_error(error, options = {}) ⇒ Object
Do not call this. Invoke the class method instead.
24 25 26 27 28 29 30 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 24 def notice_error(error, ={}) # :nodoc:11 if @exceptions[error] @exceptions[error].merge! else @exceptions[error] = end end |
#record_exceptions(attributes) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/ting_yun/agent/transaction/exceptions.rb', line 14 def record_exceptions(attributes) unless @exceptions.empty? @exceptions.each do |exception, | [:attributes] = attributes ::TingYun::Agent.instance.error_collector.notice_error(exception, ) end end end |