Ic_cdk::trap equivalent in motoko

Is there an API in Motoko similar to the Rust API ic_cdk::trap? ic_cdk::trap can explicitly propagate the error message to the client, and the state changes before trap are reverted.

There is throw Error.reject("xxxx") in Motoko, but the state changes before it are not reverted.

No, but there should be. You can trap with assert false, but not lass a message.

Might actually be a good newcomer’s tasks for anyone wanting to get involved with Motoko.