I want to use service, defined in my .did file:
"deposit_memo" : (FundMem) -> (opt Error);
This method is defined in my canister,
#[update]
#[candid_method]
async fn deposit_memo(fundmem: FundMem) -> Option<Error> {
STATE
.write()
.unwrap()
.deposit_icp_memo(blocktime(), fundmem)
.await
.err()
}
Now, what is important here, is that I simply want to define a generic error output in my .did file.
I know that deposit_icp_memo
returns no error.
But in my current code, when I call the service, defining the Error in my .did file as follows:
type Error = nat 8;
or
type Error = null;
or
type Error = variant { InvalidInput : text };
there is an output in the function,
deposit_memo output: FIX ME! opt table1 <: opt Error via special opt rule.
This means the sender and receiver type has diverged, and can cause data loss.
(null)
Note that I know that the function completes without error on rust side, so probably I need to specify the Error differently in the .did file? I simply need a very generic error message. Thanks in advance!