WalletConnect / WalletConnectSharp

A C# implementation of the WalletConnect protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypedEventHandler does not forward Error in RequestCallback method

bugbytesinc opened this issue · comments

In the TypedEventHandler within the Core project, there is a missing edge case where an Error attached to the result is not forwarded for further processing. At this line:

if (rea.Response != null || rea.Error != null)

we have:

if (rea.Response != null || rea.Error != null)
{
    await _ref.MessageHandler.SendResult<T, TR>(arg2.Id, arg1, rea.Response);
}

If the Response is null because the Error is not, the error is not propagated to the, would suggest something like the following instead:

            if (rea.Error != null)
            {
                await _ref.MessageHandler.SendError<T, TR>(arg2.Id, arg1, rea.Error);
            }
            else if (rea.Response != null)
            {
                await _ref.MessageHandler.SendResult<T, TR>(arg2.Id, arg1, rea.Response);
            }

This follows the patterns seen elsewhere in the code.