+- Returning `Result` gives callers typed errors: generated clients expose both `foo()` (panics on error) and `try_foo()` returning `Result<Result<T, _>, Result<E, InvokeError>>`. `Err(Ok(e))` is your typed error. `Err(Err(_))` is an `InvokeError`: a panic or host-level failure (bad auth, type mismatch), or an error code your `E` does not define. `Ok(Err(_))` means the return value failed to convert to `T`. If `foo` does not return `Result`, `E` is `soroban_sdk::Error`, so host failures arrive as `Err(Ok(_))`. Budget exhaustion and footprint violations are not recoverable, so `try_` cannot catch them. In tests: `assert_eq!(client.try_transfer(&from, &to, &0), Err(Ok(ContractError::InvalidAmount)));`
0 commit comments