Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions soroban-sdk-macros/src/derive_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) ->
if cfg!(not(feature = "testutils")) {
quote! {
#(#fn_attrs)*
/// This function may panic if the contract returns an error or panics itself.
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
pub fn #fn_ident(&self, #(#fn_input_types),*) -> #fn_output {
use core::ops::Not;
use #crate_path::{IntoVal,FromVal};
Expand All @@ -245,6 +246,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) ->
}

#(#fn_attrs)*
/// This function will not panic but return errors, even if the calling contract panics, the panic will be caught into an error.
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
pub fn #fn_try_ident(&self, #(#fn_input_types),*) -> #fn_try_output {
use #crate_path::{IntoVal,FromVal};
let res = self.env.try_invoke_contract(
Expand All @@ -258,6 +260,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) ->
} else {
quote! {
#(#fn_attrs)*
/// This function may panic if the contract returns an error or panics itself.
pub fn #fn_ident(&self, #(#fn_input_types),*) -> #fn_output {
use core::ops::Not;
let old_auth_manager = self.env.in_contract().not().then(||
Expand Down Expand Up @@ -291,6 +294,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) ->
}

#(#fn_attrs)*
/// This function will not panic but return errors, even if the calling contract panics, the panic will be caught into an error.
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
pub fn #fn_try_ident(&self, #(#fn_input_types),*) -> #fn_try_output {
use core::ops::Not;
let old_auth_manager = self.env.in_contract().not().then(||
Expand Down