lib/async/task.rb in async-2.6.4 vs lib/async/task.rb in async-2.6.5

- old
+ new

@@ -173,10 +173,10 @@ task.run(*arguments) return task end - # Retrieve the current result of the task. Will cause the caller to wait until result is available. If the result was an exception, raise that exception. + # Retrieve the current result of the task. Will cause the caller to wait until result is available. If the task resulted in an unhandled error (derived from `StandardError`), this will be raised. If the task was stopped, this will return `nil`. # # Conceptually speaking, waiting on a task should return a result, and if it throws an exception, this is certainly an exceptional case that should represent a failure in your program, not an expected outcome. In other words, you should not design your programs to expect exceptions from `#wait` as a normal flow control, and prefer to catch known exceptions within the task itself and return a result that captures the intention of the failure, e.g. a `TimeoutError` might simply return `nil` or `false` to indicate that the operation did not generate a valid result (as a timeout was an expected outcome of the internal operation in this case). # # @raises [RuntimeError] If the task's fiber is the current fiber. # @returns [Object] The final expression/result of the task's block.