Sha256: 5cac210449a0f50b7463bb6e72c77453a62096cfee28dcffdfba256d44d38bd6

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

module Methadone
  # Standard exception you can throw to exit with a given 
  # status code. Prefer Methadone::Main#exit_now! over this
  class Error < StandardError
    attr_reader :exit_code
    # Create an Error with the given status code and message
    def initialize(exit_code,message=nil)
      super(message)
      @exit_code = exit_code
    end
  end

  # Thrown by certain methods when an externally-called command exits nonzero
  class FailedCommandError < Error

    # The command that caused the failure
    attr_reader :command

    def initialize(exit_code,command)
      super(exit_code,"Command '#{command}' exited #{exit_code}")
      @command = command
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
methadone-1.0.0.rc2 lib/methadone/error.rb
methadone-1.0.0.rc1 lib/methadone/error.rb