diff --git a/core/src/main/scala/ox/scoped.scala b/core/src/main/scala/ox/scoped.scala index c863f9ef..29068094 100644 --- a/core/src/main/scala/ox/scoped.scala +++ b/core/src/main/scala/ox/scoped.scala @@ -8,7 +8,7 @@ private class DoNothingScope[T] extends StructuredTaskScope[T](null, Thread.ofVi /** Starts a new scope, which allows starting forks in the given code block `f`. Forks can be started using [[fork]], [[forkUser]], * [[forkCancellable]] and [[forkUnsupervised]]. All forks are guaranteed to complete before this scope completes. * - * **Warning:** It is advisable to use [[supevised]] scopes if possible, as they minimise the chances of an error to go unnoticed. + * **Warning:** It is advisable to use [[supervised]] scopes if possible, as they minimise the chances of an error to go unnoticed. * [[scoped]] scopes are considered an advanced feature, and should be used with caution. * * The scope is ran in unsupervised mode, that is: @@ -19,6 +19,8 @@ private class DoNothingScope[T] extends StructuredTaskScope[T](null, Thread.ofVi * * Forks created using [[fork]], [[forkUser]] and [[forkUnsupervised]] will behave exactly the same. * + * Upon successful completion, returns the result of evaluating `f`. Upon failure, that is an exception thrown by `f`, it is re-thrown. + * * @see * [[supervised]] Starts a scope in supervised mode */ diff --git a/core/src/main/scala/ox/supervised.scala b/core/src/main/scala/ox/supervised.scala index 4b66fb5e..bf382e71 100644 --- a/core/src/main/scala/ox/supervised.scala +++ b/core/src/main/scala/ox/supervised.scala @@ -14,6 +14,10 @@ import java.util.concurrent.{CompletableFuture, ConcurrentHashMap} * - the scope completes (that is, this method returns) only once all forks started by `f` have completed (either successfully, or with * an exception) * + * Upon successful completion, returns the result of evaluating `f`. Upon failure, the exception that caused the scope to end is re-thrown + * (regardless if the exception was thrown from the main body, or from a fork). Any other exceptions that occur when completing the scope + * are added as suppressed. + * * @see * [[scoped]] Starts a scope in unsupervised mode */