Module: Derelict::Exception::OptionalReason
- Included in:
- Connection::Invalid, Instance::Invalid, Parser::BoxList::InvalidFormat, Parser::PluginList::InvalidFormat, Parser::Status::InvalidFormat, Parser::Version::InvalidFormat, VirtualMachine::Invalid
- Defined in:
- lib/derelict/exception/optional_reason.rb
Overview
An exception that has a message and optional additional reason
The reason can be passed to the constructor (if desired). When a reason is passed, it’s appended to the default message. If no reason is passed, the default message is used.
Instance Method Summary collapse
-
#initialize(reason = nil) ⇒ Object
Initializes a new instance of this exception, with a reason.
Instance Method Details
#initialize(reason = nil) ⇒ Object
Initializes a new instance of this exception, with a reason
* reason: Optional reason to add to the default error message
(optional, the default message will be used if no
reason is provided)
14 15 16 17 18 19 20 |
# File 'lib/derelict/exception/optional_reason.rb', line 14 def initialize(reason = nil) if reason.nil? super else super "#{}: #{reason}" end end |