# How to determine error from relayed call

**URL:** <https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935>\
**Category:** Contracts\
**Created:** [December 13, 2019, 10:22am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935 "2019-12-13T10:22:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirphemmiey](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/sirphemmiey/32/1479_2.png) [@sirphemmiey](https://forum.openzeppelin.com/u/sirphemmiey)\
**Post date:** [December 13, 2019, 10:22am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935/1 "2019-12-13T10:22:56Z")

</div>

Yes, thanks. I got that ([Request to a relayer from web3](https://forum.openzeppelin.com/t/request-to-a-relayer-from-web3/1929/4)).

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?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 13, 2019, 10:37am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935/2 "2019-12-13T10:37:17Z")

</div>

Hi @sirphemmiey,

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

---

<div class="post-metadata">

**Author:** ![sirphemmiey](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/sirphemmiey/32/1479_2.png) [@sirphemmiey](https://forum.openzeppelin.com/u/sirphemmiey)\
**Post date:** [December 13, 2019, 11:13am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935/3 "2019-12-13T11:13:46Z")

</div>

Alright, thank you.

I look forward to it.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 16, 2019, 3:50am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935/4 "2019-12-16T03:50:30Z")

</div>

Hi @sirphemmiey,

If you want to reject a request to relay a call, then your contract should return [`_rejectRelayedCall`](https://docs.openzeppelin.com/contracts/2.x/api/gsn#GSNRecipient-_rejectRelayedCall-uint256-) in `approveRelayedCall`.  
The error number passed to `_rejectRelayedCall` will be available on the client.

For example, GSNReceipientERC20Fee.sol:

> <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/GSNRecipientERC20Fee.sol#L69>

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.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 23, 2019, 12:14am UTC](https://forum.openzeppelin.com/t/how-to-determine-error-from-relayed-call/1935/5 "2019-12-23T00:14:24Z")

</div>

Hi @sirphemmiey,

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