Get the return value from a Result, throwing an appropriate error if the result isn't a ValueResult.
The result you want to unwrap. Must not be undefined!
The value if the result is a ValueResult, or a thrown error if it's an ErrorResult. A CancelError is thrown if the result is CancelResult.
If the result is an error, it is marked as handled.
Get the return value from a Result, throwing an appropriate error if the result isn't a ValueResult.