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.



34
35
36
37
# File 'lib/imw/utils/error.rb', line 34

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

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



32
33
34
# File 'lib/imw/utils/error.rb', line 32

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



32
33
34
# File 'lib/imw/utils/error.rb', line 32

def status
  @status
end

Instance Method Details

#displayObject



39
40
41
# File 'lib/imw/utils/error.rb', line 39

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

#to_sObject



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

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