Skip to content

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.

T

T

The compiled result to extract from.

OkResult<T>

The extracted value from the compiled result.

CanisterError with the typed error value if result is { Err: E } or { err: E }