Produce a Task<T, E> from a promise of a Result<T, E>.
Warning
This constructor assumes you have already correctly handled the promise
rejection state, presumably by mapping it into the wrapped Result. It is
unsafe for this promise ever to reject! You should only ever use this
with Promise<Result<T, E>> you have created yourself (including via a
Task, of course).
For any other Promise<Result<T, E>>, you should first attach a catch
handler which will also produce a Result<T, E>.
If you call this with an unmanaged Promise<Result<T, E>>, that is, one
that has not correctly set up a catch handler, the rejection will
throw an UnsafePromise error that will not be catchable
by awaiting the Task or its original Promise. This can cause test
instability and unpredictable behavior in your application.
Produce a
Task<T, E>
from a promise of aResult<T, E>
.This constructor assumes you have already correctly handled the promise rejection state, presumably by mapping it into the wrapped
Result
. It is unsafe for this promise ever to reject! You should only ever use this withPromise<Result<T, E>>
you have created yourself (including via aTask
, of course).For any other
Promise<Result<T, E>>
, you should first attach acatch
handler which will also produce aResult<T, E>
.If you call this with an unmanaged
Promise<Result<T, E>>
, that is, one that has not correctly set up acatch
handler, the rejection will throw anUnsafePromise
error that will not be catchable by awaiting theTask
or its originalPromise
. This can cause test instability and unpredictable behavior in your application.