When I send EOS in a contract to several recipients, it can happen that this fails, e.g. because a recipient has a contract running like that:
Example contract of one recipient:
[[eosio::on_notify("eosio.token::transfer")]]
void deposit(name from, name to, eosio::asset quantity, std::string memo){
if (from == get_self() || to != get_self()){
return;
}
}
Withdraw function in my contract:
void withdrawall(std::list<transaction> trans)
{
for(auto& tr : trans)
{
action{
permission_level{ get_self(), "active"_n},
"eosio.token"_n,
"transfer"_n,
std::make_tuple(get_self(), tr.to, tr.funds, std::string(""))
}.send();
}
}
Because one transaction cannot be executed, all transactions fail. Is there a way to catch such failures in the contract and execute alternative code?