Exception: Squixtures::SquixtureError
- Inherits:
-
StandardError
- Object
- StandardError
- Squixtures::SquixtureError
- Defined in:
- lib/squixtures/exceptions.rb
Overview
This class provides the exception class used by the Squixtures library.
Instance Attribute Summary collapse
-
#verbose ⇒ Object
Attribute accessor/mutator declarations.
Instance Method Summary collapse
-
#initialize(message, cause = nil, verbose = true) ⇒ SquixtureError
constructor
Constructor for the SquixtureError class.
-
#to_s ⇒ Object
This method fetches a stringified interpretation of an exception.
Constructor Details
#initialize(message, cause = nil, verbose = true) ⇒ SquixtureError
Constructor for the SquixtureError class.
Parameters
- message
-
The message to be associated with the error.
- cause
-
Any underlying exception to be associated with the error. Defaults to nil.
18 19 20 21 22 |
# File 'lib/squixtures/exceptions.rb', line 18 def initialize(, cause=nil, verbose=true) super() @cause = cause @verbose = verbose end |
Instance Attribute Details
#verbose ⇒ Object
Attribute accessor/mutator declarations.
10 11 12 |
# File 'lib/squixtures/exceptions.rb', line 10 def verbose @verbose end |
Instance Method Details
#to_s ⇒ Object
This method fetches a stringified interpretation of an exception.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/squixtures/exceptions.rb', line 25 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 |