Sha256: 83818da7504f5f92b0f79f4e23ba1f7b9af8147778bafa4a64193fdd9bef8a9d

Contents?: true

Size: 623 Bytes

Versions: 8

Compression:

Stored size: 623 Bytes

Contents

class Mothership
  class Error < RuntimeError
  end

  class MissingArgument < Error
    def initialize(cmd, arg)
      @command = cmd
      @argument = arg
    end

    def to_s
      "#{@command}: missing input '#{@argument}'"
    end
  end

  class ExtraArguments < Error
    def initialize(cmd)
      @command = cmd
    end

    def to_s
      "#{@command}: too many arguments"
    end
  end

  class TypeMismatch < Error
    def initialize(cmd, input, type)
      @command = cmd
      @input = input
      @type = type
    end

    def to_s
      "#{@command}: expected #{@type} value for #{@input}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mothership-0.0.8 lib/mothership/errors.rb
mothership-0.0.7 lib/mothership/errors.rb
mothership-0.0.6 lib/mothership/errors.rb
mothership-0.0.5 lib/mothership/errors.rb
mothership-0.0.4 lib/mothership/errors.rb
mothership-0.0.3 lib/mothership/errors.rb
mothership-0.0.2 lib/mothership/errors.rb
mothership-0.0.1 lib/mothership/errors.rb