Method: Concurrent::Promise#fail

Defined in:
lib/concurrent/promise.rb

#fail(reason = StandardError.new) ⇒ IVar

Set the IVar to failed due to some error and wake or notify all threads waiting on it.

Parameters:

  • (defaults to: StandardError.new)

    for the failure

Returns:

  • self

Raises:

  • if the IVar has already been set or otherwise completed

  • if not the root promise



277
278
279
# File 'lib/concurrent/promise.rb', line 277

def fail(reason = StandardError.new)
  set { raise reason }
end