Case macro for the different kinds of command-error structures.
This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a command-error structure, or to split into cases based on its type.
In its short form,
(command-error-case x :malformed-mnemonic)
is essentially just a safer alternative to writing:
(equal (command-error-kind x) :malformed-mnemonic)
Why is using command-error-case safer? When we directly inspect the
kind with
In its longer form,
(command-error-case x :malformed-mnemonic ... :malformed-passphrase ... :malformed-entropy ... :malformed-nonce ... :malformed-gas-price ... :malformed-gas-limit ... :malformed-to ... :malformed-value ... :malformed-data ... :malformed-address-key-index ... :address-key-index-too-large ... :address-key-index-skipped ... :root-key-derivation-fail ... :purpose-key-derivation-fail ... :coin-type-key-derivation-fail ... :account-key-derivation-fail ... :external-chain-key-derivation-fail ... :address-key-derivation-fail ... :address-key-index-limit ... :pretransaction-rlp-fail ... :transaction-sign-fail ... :transaction-rlp-fail ... :state-file-untestable ... :state-file-absent ... :state-file-present ... :state-file-not-regular ... :state-file-malformed ... :wrong-number-of-arguments ... :wrong-command ... :no-command ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of