Sha256: d8623e69b73fa2581aa4fc1b522c0f99d901738323fec793d4aeff065aeaaff5

Contents?: true

Size: 2 KB

Versions: 2

Compression:

Stored size: 2 KB

Contents

# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2009-2010, Sebastian Staudt

module Rubikon

  # Raised by commands if no block is given and no corresponding command file
  # exists
  #
  # @author Sebastian Staudt
  # @see Command
  # @since 0.1.0
  class BlockMissingError < ArgumentError
  end

  # Raised by parameters that have been supplied with more arguments than they
  # take
  #
  # @author Sebastian Staudt
  # @see Parameter
  # @see 0.3.0
  class ExtraArgumentError < ArgumentError

    def initialize(parameter)
      super "Parameter #{parameter} has one or more extra arguments."
    end

  end

  # Raised by parameters that have been supplied with not all required
  # arguments
  #
  # @author Sebastian Staudt
  # @see Parameter
  # @since 0.1.0
  class MissingArgumentError < ArgumentError

    def initialize(parameter)
      super "Parameter #{parameter} is missing one or more arguments."
    end

  end

  # Raised if the user did not specify a command and no default command exists
  #
  # @author Sebastian Staudt
  # @since 0.3.0
  class NoDefaultCommandError < ArgumentError

    def initialize
      super 'You did not specify a command and there is no default command.'
    end

  end

  # Raised if a command has been supplied that does not exist
  #
  # @author Sebastian Staudt
  # @since 0.3.0
  class UnknownCommandError < ArgumentError

    def initialize(name)
      super "Unknown command: #{name}"
    end

  end

  # Raised if a parameter has been supplied that does not exist
  #
  # @author Sebastian Staudt
  # @since 0.3.0
  class UnknownParameterError < ArgumentError

    def initialize(name)
      super "Unknown parameter: #{name}"
    end

  end

  # Raised if a command has been supplied that does not exist
  #
  # @author Sebastian Staudt
  # @since 0.5.0
  class UnsupportedConfigFormatError < ArgumentError

    def initialize(ext)
      super "Unknown config file extension: #{ext}"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubikon-0.5.1 lib/rubikon/exceptions.rb
rubikon-0.5.0 lib/rubikon/exceptions.rb