Skip to content

Commit 4bde89b

Browse files
committed
Improved documentation.
1 parent caeec3b commit 4bde89b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/async/task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def async(*arguments, **options, &block)
175175
return task
176176
end
177177

178-
# 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.
178+
# 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`.
179179
#
180180
# 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).
181181
#

0 commit comments

Comments
 (0)