Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use transaction id from error to print out explorer link for errors #463

Merged
merged 4 commits into from
Jul 28, 2020

Conversation

janedegtiareva
Copy link
Contributor

@janedegtiareva janedegtiareva commented Jul 21, 2020

Note that there is currently no good way to tell if a transaction got included in the chain without an extra RPC, so sometimes this link will not be valid.

To reproduce error behavior, the easiest way is to try to send too much money to another account
e.g.

node bin\near send jane.betanet jane2.betanet 1000

This depends on near/near-api-js#362

@mikedotexe
Copy link
Contributor

Can we get some steps on how to reproduce please?

@mikedotexe
Copy link
Contributor

there are some linting issues to address, please :)

@janedegtiareva janedegtiareva marked this pull request as draft July 27, 2020 21:11
@janedegtiareva janedegtiareva marked this pull request as ready for review July 28, 2020 22:42
@janedegtiareva
Copy link
Contributor Author

Tested:
node bin\near send jane.betanet jane2.betanet 1000
Sending 1000 NEAR to jane2.betanet from jane.betanet
An error occured
NotEnoughBalance [Error]: Sender jane.betanet does not have enough balance 45000000521675913419670000 for operation costing 1000000453060601875000000000
at Object.parseRpcError (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\utils\rpc_errors.js:38:19)
at JsonRpcProvider.sendJsonRpc (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\providers\json-rpc-provider.js:147:40)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Account.signAndSendTransaction (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\account.js:116:22)
at async exports.sendMoney (C:\Users\janed\near\near-shell\index.js:203:20)
at async Object.handler (C:\Users\janed\near\near-shell\utils\exit-on-error.js:39:9) {
[stack]: 'Error: Sender jane.betanet does not have enough balance 45000000521675913419670000 for operation costing 1000000453060601875000000000\n' +
' at Object.parseRpcError (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\utils\rpc_errors.js:38:19)\n' +
' at JsonRpcProvider.sendJsonRpc (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\providers\json-rpc-provider.js:147:40)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:97:5)\n' +
' at async Account.signAndSendTransaction (C:\Users\janed\near\near-shell\node_modules\near-api-js\lib\account.js:116:22)\n' +
' at async exports.sendMoney (C:\Users\janed\near\near-shell\index.js:203:20)\n' +
' at async Object.handler (C:\Users\janed\near\near-shell\utils\exit-on-error.js:39:9)',
[message]: 'Sender jane.betanet does not have enough balance 45000000521675913419670000 for operation costing 1000000453060601875000000000',
type: 'NotEnoughBalance',
context: ErrorContext {
transactionHash: '4G53DL72E4gZmDbeu74ajp5Q8N6vxzcoAwrMrQs7FeLp'
},
balance: '45000000521675913419670000',
cost: '1000000453060601875000000000',
signer_id: 'jane.betanet'
}
We attempted to send transaction 4G53DL72E4gZmDbeu74ajp5Q8N6vxzcoAwrMrQs7FeLp to NEAR, but something went wrong.
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.betanet.near.org/transactions/4G53DL72E4gZmDbeu74ajp5Q8N6vxzcoAwrMrQs7FeLp
Note: if the transaction was invalid (e.g. not enough balance), it will show as Not started/Finalizing.

Copy link
Contributor

@mikedotexe mikedotexe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor suggestion, lgtm!

Co-authored-by: Mike Purvis <mikedotexe@gmail.com>
@janedegtiareva janedegtiareva merged commit 46ba4d3 into master Jul 28, 2020
@janedegtiareva janedegtiareva deleted the explorer-link-on-error branch July 28, 2020 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants