Exception: SimpleFuture::ChildError

Inherits:
Error
  • Object
show all
Defined in:
lib/simple-future.rb

Overview

Exception class for the case where an uncaught exception is thrown in the child process.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, cause = nil) ⇒ ChildError

Returns a new instance of ChildError.

Parameters:

  • msg (String)

    The exception text.

  • cause (Exception) (defaults to: nil)

    If valid, the exception raised in the child



52
53
54
55
# File 'lib/simple-future.rb', line 52

def initialize(msg, cause = nil)
  super(msg)
  @cause = cause
end

Instance Attribute Details

#causeObject (readonly)

If the child process threw an exception, this is it. Otherwise, it's nil.



48
49
50
# File 'lib/simple-future.rb', line 48

def cause
  @cause
end

Instance Method Details

#to_sObject



57
58
59
60
61
# File 'lib/simple-future.rb', line 57

def to_s
  result = super.to_s
  result += " (cause: #{cause.class} '#{@cause.to_s}')" if @cause
  return result
end