Exception: UsageError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- UsageError
- Defined in:
- Library/Homebrew/exceptions.rb
Overview
Raised when a command is used wrong.
Direct Known Subclasses
FormulaOrCaskUnspecifiedError, FormulaUnspecifiedError, Homebrew::CLI::InvalidConstraintError, Homebrew::CLI::MaxNamedArgumentsError, Homebrew::CLI::MinNamedArgumentsError, Homebrew::CLI::OptionConflictError, Homebrew::CLI::OptionConstraintError, KegUnspecifiedError
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#initialize(reason = nil) ⇒ UsageError
constructor
A new instance of UsageError.
- #to_s ⇒ Object
Constructor Details
#initialize(reason = nil) ⇒ UsageError
Returns a new instance of UsageError.
11 12 13 14 15 |
# File 'Library/Homebrew/exceptions.rb', line 11 def initialize(reason = nil) super @reason = reason end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason
9 10 11 |
# File 'Library/Homebrew/exceptions.rb', line 9 def reason @reason end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 21 |
# File 'Library/Homebrew/exceptions.rb', line 17 def to_s s = "Invalid usage" s += ": #{reason}" if reason s end |