Exception: Grit::Git::CommandFailed
- Inherits:
-
StandardError
- Object
- StandardError
- Grit::Git::CommandFailed
- Defined in:
- lib/grit/git.rb
Overview
Raised when a native git command exits with non-zero.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
The full git command that failed as a String.
-
#err ⇒ Object
readonly
Everything output on the command’s stderr as a String.
-
#exitstatus ⇒ Object
readonly
The integer exit status.
-
#out ⇒ Object
readonly
Everything output on the command’s stdout as a String.
Instance Method Summary collapse
-
#initialize(command, exitstatus = nil, err = '', out = '') ⇒ CommandFailed
constructor
A new instance of CommandFailed.
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 = "Command failed [#{exitstatus}]: #{command}" << "\n\n" << err unless err.nil? || err.empty? super else super command end end |
Instance Attribute Details
#command ⇒ Object (readonly)
The full git command that failed as a String.
21 22 23 |
# File 'lib/grit/git.rb', line 21 def command @command end |
#err ⇒ Object (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 |
#exitstatus ⇒ Object (readonly)
The integer exit status.
24 25 26 |
# File 'lib/grit/git.rb', line 24 def exitstatus @exitstatus end |
#out ⇒ Object (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 |