Error

Error values and inspection.

The Error type is the argument to throw, parameter of catch. The Error type is opaque.

ErrorCode

Error codes (user and system), where module Prim defines:

type ErrorCode = {
  // Fatal error.
  #system_fatal;
  // Transient error.
  #system_transient;
  // Destination invalid.
  #destination_invalid;
  // Explicit reject by canister code.
  #canister_reject;
  // Canister trapped.
  #canister_error;
  // Future error code (with unrecognized numeric code)
  #future : Nat32;
};
type ErrorCode = Prim.ErrorCode

reject

Create an error from message m with code #canister_reject.

let reject : (m : Text) -> Error

code

Returns the code of an error e.

let code : (e : Error) -> ErrorCode

message

Returns the message of an error e.

let message : (e : Error) -> Text