Exception: Rant::CommandError

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

Overview

class MultiFileList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, status = nil, msg = nil) ⇒ CommandError

Returns a new instance of CommandError.



133
134
135
136
137
# File 'lib/rant/rantsys.rb', line 133

def initialize(cmd, status=nil, msg=nil)
    @msg = msg
    @cmd = cmd
    @status = status
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



131
132
133
# File 'lib/rant/rantsys.rb', line 131

def cmd
  @cmd
end

#statusObject (readonly)

Returns the value of attribute status.



132
133
134
# File 'lib/rant/rantsys.rb', line 132

def status
  @status
end

Instance Method Details

#messageObject



138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/rant/rantsys.rb', line 138

def message
    if !@msg && cmd
	if status
	    "Command failed with status #{status.exitstatus}:\n" +
	    "[#{cmd}]"
	else
	    "Command failed:\n[#{cmd}]"
	end
    else
	@msg
    end
end