lib/rubikon/exceptions.rb in rubikon-0.5.1 vs lib/rubikon/exceptions.rb in rubikon-0.5.2

- old
+ new

@@ -43,10 +43,11 @@ end # Raised if the user did not specify a command and no default command exists # # @author Sebastian Staudt + # @see Application::DSLMethods#default # @since 0.3.0 class NoDefaultCommandError < ArgumentError def initialize super 'You did not specify a command and there is no default command.' @@ -55,21 +56,34 @@ end # Raised if a command has been supplied that does not exist # # @author Sebastian Staudt + # @see Application::DSLMethods#command # @since 0.3.0 class UnknownCommandError < ArgumentError + # @return [Symbol] The name of the command that has been tried to access + attr_reader :command + + # Creates a new error and stores the name of the command that could not be + # found + # + # @param [Symbol] name The name of the unknown command def initialize(name) super "Unknown command: #{name}" + @command = name end end # Raised if a parameter has been supplied that does not exist # # @author Sebastian Staudt + # @see Application::DSLMethods#flag + # @see Application::DSLMethods#option + # @see Application::DSLMethods#global_flag + # @see Application::DSLMethods#global_option # @since 0.3.0 class UnknownParameterError < ArgumentError def initialize(name) super "Unknown parameter: #{name}"