class Scutil::Error
Exception class for scutil. The system, error message, and return value of the remote command are stored here on error.
begin Scutil.exec_command('ls -al /root') rescue Scutil::Error => err puts "Message: " + err.message puts "Hostname: " + err.hostname puts "Exit status: #{err.command_exit_status}" end
Will produce:
Message: Error: ls: /root: Permission denied Hostname: server.name.com Exit status: 2
Attributes
command_exit_status[R]
hostname[R]
message[R]
Public Class Methods
new(message=nil, hostname=nil, command_exit_status=-1)
click to toggle source
# File lib/scutil/error.rb, line 22 def initialize(message=nil, hostname=nil, command_exit_status=-1) @message = message @hostname = hostname @command_exit_status = command_exit_status end
Public Instance Methods
to_s()
click to toggle source
# File lib/scutil/error.rb, line 28 def to_s "Message: #{@message}\nHostname: #{@hostname}\nExit status: #{command_exit_status}\n" end