extractOkResult
extractOkResult<
T>(result):OkResult<T>
Defined in: utils/helper.ts:56
Helper function for extracting the value from a compiled result { Ok: T } or throw a CanisterError if { Err: E } Supports both uppercase (Ok/Err - Rust) and lowercase (ok/err - Motoko) conventions.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”result
Section titled “result”T
The compiled result to extract from.
Returns
Section titled “Returns”OkResult<T>
The extracted value from the compiled result.
Throws
Section titled “Throws”CanisterError with the typed error value if result is { Err: E } or { err: E }