Exception: ShellWhisperer::CommandFailed

Inherits:
StandardError
  • Object
show all
Defined in:
lib/shell_whisperer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, result, exit_code) ⇒ CommandFailed

Returns a new instance of CommandFailed.



8
9
10
11
12
13
14
15
# File 'lib/shell_whisperer.rb', line 8

def initialize(cmd, result, exit_code)
  @original_command = cmd
  @original_message = result
  @exit_code = exit_code

  super "Attempted to run #{cmd.inspect} but the shell reported error: " \
        "#{result.chomp.inspect} and exited with exit code #{exit_code}."
end

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



6
7
8
# File 'lib/shell_whisperer.rb', line 6

def exit_code
  @exit_code
end

#original_commandObject (readonly)

Returns the value of attribute original_command.



6
7
8
# File 'lib/shell_whisperer.rb', line 6

def original_command
  @original_command
end

#original_messageObject (readonly)

Returns the value of attribute original_message.



6
7
8
# File 'lib/shell_whisperer.rb', line 6

def original_message
  @original_message
end