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 = '', out = '') ⇒ CommandFailed

Returns a new instance of CommandFailed.



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/grit/git.rb', line 32

def initialize(command, exitstatus=nil, err='', out='')
  if exitstatus
    @command = command
    @exitstatus = exitstatus
    @err = err
    @out = out
    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.



30
31
32
# File 'lib/grit/git.rb', line 30

def err
  @err
end

#exitstatusObject (readonly)

The integer exit status.



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

def exitstatus
  @exitstatus
end

#outObject (readonly)

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



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

def out
  @out
end