Sha256: f6ff965da082872c1d4019820280d627da0a7c635aae5a57e033d5253f691d06

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

module Slop
  # Base error class.
  class Error < StandardError
  end

  # Raised when calling `call` on Slop::Option (this
  # method must be overriden in subclasses)
  class NotImplementedError < Error
  end

  # Raised when an option that expects an argument is
  # executed without one. Suppress with the `suppress_errors`
  # config option.
  class MissingArgument < Error
    attr_reader :flags

    # Get all the flags that matches
    # the option with the missing argument
    def initialize(msg, flags)
      super(msg)
      @flags = flags
    end
  end

  # Raised when an unknown option is parsed or when trying to fetch an
  # unexisting option via `Slop::Result#fetch`.
  # Suppress with the `suppress_errors` config option.
  class UnknownOption < Error
    attr_reader :flag

    def initialize(msg, flag)
      super(msg)
      @flag = flag
    end
  end

  # Raised when a required option is *not* parsed.
  # Suppress with the `suppress_errors` config option.
  class MissingRequiredOption < Error
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slop-4.9.3 lib/slop/error.rb
slop-4.9.2 lib/slop/error.rb
slop-4.9.1 lib/slop/error.rb
slop-4.9.0 lib/slop/error.rb
slop-4.8.2 lib/slop/error.rb
slop-4.8.1 lib/slop/error.rb
slop-4.8.0 lib/slop/error.rb
slop-4.7.0 lib/slop/error.rb