Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What Deprecate `fuzz_catch_panic`, encouraging developers to use the `try_` invoke functions instead. ### Why The fuzz_catch_panic function catches panics that occur when the contract fails and generates a panic. It is necessary to often catch panics when testing contracts because contract errors are populated up to the test as a panic when called from their regular client invoking function. However, contract clients, and the env, also have `try_` variants of each function for calling a contract. When the try variant is used, panics and contract errors are caught and molded into a `Result<Result<_,_>, Result<_,_>>` developers can assert on. Developers in tests can then assert did the contract: 1. Succeed and return the expected type, `Ok(Ok(_))` 2. Error and return an expected contract error type as defined by a `contracterror` enum, `Err(Ok(_))` 3. Succeed and return an unexpected type, `Ok(Err(_))` 4. Error and return an abort (panic), or system / host error, or a contract error not included in the `contracterror` enum, `Err(Err(_))` ### Known limitations As far as I can tell the purposes of `fuzz_catch_panic` can be served by the `Env` `try_invoke` and the generated contract client `try_` functions, but I'd be interested to hear from @brson to confirm if I'm missing any case where we'd want to keep `fuzz_catch_panic`. ### Docs The stellar-docs need updating as well.
- Loading branch information