Class: IMW::SystemCallError

Inherits:
Error
  • Object
show all
Defined in:
lib/imw/utils/error.rb

Overview

An error meant to be used when a system call goes awry. It will report exit status and the process id of the offending call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message) ⇒ SystemCallError

Returns a new instance of SystemCallError.



43
44
45
46
# File 'lib/imw/utils/error.rb', line 43

def initialize(status, message)
  @status  = status
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



41
42
43
# File 'lib/imw/utils/error.rb', line 41

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



41
42
43
# File 'lib/imw/utils/error.rb', line 41

def status
  @status
end

Instance Method Details

#displayObject



48
49
50
# File 'lib/imw/utils/error.rb', line 48

def display
  "(error code: #{status.exitstatus}, pid: #{status.pid}) #{message}"
end

#to_sObject



52
53
54
# File 'lib/imw/utils/error.rb', line 52

def to_s
  "(error code: #{status.exitstatus}, pid: #{status.pid}) #{message}"
end