Method: Concurrent::Promise#fail

Defined in:
lib/concurrent-ruby/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:

  • reason (Object) (defaults to: StandardError.new)

    for the failure

Returns:

Raises:



278
279
280
# File 'lib/concurrent-ruby/concurrent/promise.rb', line 278

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