New Candid Version and Catching Send Failures: Motoko Updates

As an example, we have a function that returns opt variant { Type1; Type2 }. And we want to extend the variant tag to opt variant { Type1; Type2; Type3 }. This was not allowed in the old candid library, or we have to upgrade both the server and client code at the same time.

With the new Candid version, you can do this safely without updating the client code: When the client receives Type1 or Type2, existing code already covers that; when the client receives Type3, the value becomes null, which will be handled by the null case. No client code update is necessary unless the client code needs to handle the new Type3 variant.

6 Likes