Exception: CmdParse::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- CmdParse::ParseError
- Defined in:
- lib/cmdparse.rb
Overview
Base class for all cmdparse errors.
Direct Known Subclasses
InvalidArgumentError, InvalidCommandError, InvalidOptionError, NoCommandGivenError, NotEnoughArgumentsError, TakesNoCommandError, TooManyArgumentsError
Class Method Summary collapse
-
.get_reason ⇒ Object
Returns the error reason or ‘CmdParse error’ if it has not been set.
-
.reason(reason) ⇒ Object
Sets the error reason for the subclass.
Instance Method Summary collapse
-
#message ⇒ Object
Returns the reason plus the original message.
Class Method Details
.get_reason ⇒ Object
Returns the error reason or ‘CmdParse error’ if it has not been set.
62 63 64 |
# File 'lib/cmdparse.rb', line 62 def self.get_reason @reason ||= 'CmdParse error' end |
.reason(reason) ⇒ Object
Sets the error reason for the subclass.
57 58 59 |
# File 'lib/cmdparse.rb', line 57 def self.reason(reason) @reason = reason end |
Instance Method Details
#message ⇒ Object
Returns the reason plus the original message.
67 68 69 70 |
# File 'lib/cmdparse.rb', line 67 def str = super self.class.get_reason + (str.empty? ? "" : ": #{str}") end |