How to determine error from relayed call

Yes, thanks. I got that (Request to a relayer from web3).

Question: Using relayed calls, when an error happens in the contract, how do we(devs) know? Because i have a require condition in my GNS-aware smart contract, but i deliberately didn’t send what is required, but the error didn’t specifically tell me what went wrong even though i returned the possible cause from within my smart contract.

How do i handle this?

1 Like

Hi @sirphemmiey,

I haven’t tried this, so will have to investigate on Monday.

Alright, thank you.

I look forward to it.

1 Like

Hi @sirphemmiey,

If you want to reject a request to relay a call, then your contract should return _rejectRelayedCall in approveRelayedCall.
The error number passed to _rejectRelayedCall will be available on the client.

For example, GSNReceipientERC20Fee.sol:

When a request to relay a call is rejected, then the recipient contract is not charged gas as the relayer will never send the transaction.

If the request to relay a call is approved by the logic in approveRelayedCall, and the call ends up reverting then the recipient contract will be charged and the revert information will not be available.

We want to write the approveRelayedCall in such a way that ensures that if approved, it won’t be reverted.

Hi @sirphemmiey,

Checking if the above resolved your question. If so can you mark it as the solution please? Otherwise please ask further questions.