Skip to content

rpc client: Handle case if aepp opened without wallet#388

Merged
nduchak merged 2 commits intodevelopfrom
feature/rpc-better-exception
May 13, 2019
Merged

rpc client: Handle case if aepp opened without wallet#388
nduchak merged 2 commits intodevelopfrom
feature/rpc-better-exception

Conversation

@davidyuk
Copy link
Member

window.parent is equal to window if a web page opened as usual. If we accidentally start dapp in this way (also not setting parent option), then rpc/client will send a hello to itself and fail with exception:

Uncaught TypeError: Cannot destructure property resolve of 'undefined' or 'null'. at receive (client.js?aafa:56)

I think much cleaner for dapp developers to handle this case separately. In that case this PR makes dapp to throw:

Uncaught (in promise) Error: rpc client: Can't send messages to itself at Object._callee$ (client.js?6b57:46)

@davidyuk davidyuk added the enhancement New feature or request label May 11, 2019
@davidyuk davidyuk force-pushed the feature/rpc-better-exception branch from 83d9a99 to 4ed6f5e Compare May 11, 2019 15:20
@nduchak nduchak merged commit 548ae05 into develop May 13, 2019
@nduchak nduchak deleted the feature/rpc-better-exception branch May 16, 2019 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants