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.