Exception: Grit::Git::CommandFailed

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

Overview

Raised when a native git command exits with non-zero.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, exitstatus = nil, err = '') ⇒ CommandFailed

Returns a new instance of CommandFailed.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/grit/git.rb', line 29

def initialize(command, exitstatus=nil, err='')
  if exitstatus
    @command = command
    @exitstatus = exitstatus
    @err = err
    message = "Command failed [#{exitstatus}]: #{command}"
    message << "\n\n" << err unless err.nil? || err.empty?
    super message
  else
    super command
  end
end

Instance Attribute Details

#commandObject (readonly)

The full git command that failed as a String.



21
22
23
# File 'lib/grit/git.rb', line 21

def command
  @command
end

#errObject (readonly)

Everything output on the command’s stderr as a String.



27
28
29
# File 'lib/grit/git.rb', line 27

def err
  @err
end

#exitstatusObject (readonly)

The integer exit status.



24
25
26
# File 'lib/grit/git.rb', line 24

def exitstatus
  @exitstatus
end