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.
Instance Method Summary collapse
-
#initialize(command, exitstatus = nil, err = '') ⇒ CommandFailed
constructor
A new instance of CommandFailed.
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 = "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.
27 28 29 |
# File 'lib/grit/git.rb', line 27 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 |