Exception: LogJam::LogJamError
- Defined in:
- lib/logjam/exceptions.rb
Overview
This class provides the exception class used by the LogJam library.
Instance Attribute Summary collapse
-
#verbose ⇒ Object
Attribute accessor/mutator declarations.
Instance Method Summary collapse
-
#initialize(message, cause = nil, verbose = true) ⇒ LogJamError
constructor
Constructor for the LogJamError class.
-
#to_s ⇒ Object
This method fetches a stringified interpretation of an exception.
Constructor Details
#initialize(message, cause = nil, verbose = true) ⇒ LogJamError
Constructor for the LogJamError class.
Parameters
- message
-
The message to be associated with the error.
- cause
-
Any underlying exception to be associated with the error. Defaults to nil.
20 21 22 23 24 |
# File 'lib/logjam/exceptions.rb', line 20 def initialize(, cause=nil, verbose=true) super() @cause = cause @verbose = verbose end |
Instance Attribute Details
#verbose ⇒ Object
Attribute accessor/mutator declarations.
12 13 14 |
# File 'lib/logjam/exceptions.rb', line 12 def verbose @verbose end |
Instance Method Details
#to_s ⇒ Object
This method fetches a stringified interpretation of an exception.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/logjam/exceptions.rb', line 27 def to_s() text = StringIO.new text << super if @verbose text << "\n" + self.backtrace.join("\n") if !@cause.nil? text << "\n\nCause: #{@cause}" text << "\n" + @cause.backtrace.join("\n") end end text.string end |