Sha256: e9052ffa21c8e4928b0a286aaff21b79c5d9246a6f464c79e2673aeebeb654cf

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module Hobo
  class Error < StandardError
  end

  class RubyVersionError < Error
    def initialize
      super("Ruby 1.9+ is required to run hobo")
    end
  end

  class MissingDependencies < Error
    def initialize deps
      deps.map! { |dep| " - #{dep}"}
      super("Hobo requires the following commands to be available on your path:\n\n" + deps.join("\n"))
    end
  end

  class InvalidCommandOrOpt < Error
    attr_accessor :command, :cli
    def initialize command, cli = nil
      @command = command
      @cli = cli
      super("Invalid command or option specified: '#{command}'")
    end
  end

  class MissingArgumentsError < Error
    attr_accessor :command, :cli
    def initialize command, args, cli = nil
      @command = command
      @args = args
      @cli = cli
      super("Not enough arguments for #{command}")
    end
  end

  class ExternalCommandError < Error
    attr_accessor :command, :exit_code, :output

    def initialize command, exit_code, output
      @command = command
      @exit_code = exit_code
      @output = output
      super("'#{command}' returned exit code #{exit_code}")
    end
  end

  class UserError < Error
  end

  class ProjectOnlyError < Error
  end

  class NonInteractiveError < Error
    def initialize question
      @question = question
      super("A task requested input from user but hobo is in non-interactive mode")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.4 lib/hobo/errors.rb
hobo-inviqa-0.0.3 lib/hobo/errors.rb
hobo-inviqa-0.0.2 lib/hobo/errors.rb