Class: Lookout::Results::Error::Exception
- Defined in:
- lib/lookout/results/error/exception.rb
Defined Under Namespace
Classes: Backtrace
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(exception) ⇒ Exception
constructor
A new instance of Exception.
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(exception) ⇒ Exception
Returns a new instance of Exception.
6 7 8 |
# File 'lib/lookout/results/error/exception.rb', line 6 def initialize(exception) @exception = exception end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
35 36 37 |
# File 'lib/lookout/results/error/exception.rb', line 35 def exception @exception end |
Instance Method Details
#backtrace ⇒ Object
27 28 29 |
# File 'lib/lookout/results/error/exception.rb', line 27 def backtrace @backtrace ||= Backtrace.new(@exception.backtrace) end |
#message ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lookout/results/error/exception.rb', line 10 def # Chomping off a \n here isn’t 100 percent compatible with how Ruby 1.9 # does it, but it simplifies the code and also makes the output better if # the message is a lone \n. = @exception..to_str.chomp("\n") if @exception.class == RuntimeError and .empty? 'unhandled exception' elsif .empty? @exception.class.name elsif @exception.class.name.empty? or @exception.class.name =~ /^#/ else before, newline, after = .partition("\n") '%s (%s)%s%s' % [before, @exception.class.name, newline, after] end end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/lookout/results/error/exception.rb', line 31 def to_s "%s\n%s" % [, backtrace] end |