Exception: RakeCommander::Base::CustomError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rake-commander/base/custom_error.rb

Overview

Note:

Although not clearly explained, this is somehow captured here https://stackoverflow.com/a/32481520/4352306

This class allows to use both method calls to raise by using additional parameters.

Direct Known Subclasses

Options::Error::Base

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ CustomError

Returns a new instance of CustomError.



6
7
8
# File 'lib/rake-commander/base/custom_error.rb', line 6

def initialize(value = nil)
  super(@message = to_message(value)) if @value = value
end

Instance Method Details

#messageObject

If @value was already set, ignore the latest message just return @message



19
20
21
22
# File 'lib/rake-commander/base/custom_error.rb', line 19

def message
  return @message if @message
  to_message(unclassed(super))
end

#to_sObject

If @value was already set, ignore the latest message and just return @message



12
13
14
15
# File 'lib/rake-commander/base/custom_error.rb', line 12

def to_s
  return @message if @message
  unclassed(super)
end