unwrapOrThrowForResult
Unwraps input, returns the content of an Ok(T)
.
Otherwise, this function throw a new Error
instance with setting the original E
in Err(E)
to .cause
property of the Error
instance.
This matches the convention that is "a thrown object is always an Error
instance".
To achive this, this function requires Error.cause
to carry the failure reason.
We DO NOT RECCOMEND TO USE THIS function generally.
This function is provided only to improve an interoperability with the world using "throw error" convention. We do not recommend to use this function.