• Get the return value from a JobResult, throwing an appropriate error if the result isn't a ValueResult.

    Type Parameters

    • T

    Parameters

    • res: JobResult<T>

      The job result you want to unwrap. Must not be undefined!

    Returns T

    The value if the result is a ValueResult, or a thrown error if it's an ErrorResult. A CancelError is thrown if the job was canceled, or the error in the result is thrown.

    If the result is an error, it is marked as handled.