You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the current behavior and expected behavior?
When submitting a tx with an account that does not have sufficient gas for fee, an error is thrown but it is never catched by the calling functions so it ends up in an unhandled rejection error.
Since nodejs 15, the default behavior when an error like this arise is to exit the process with code 1. In other terms if I submit a transaction with not enough balance, my app crashes without asking anything.
This behavior can be prevented by adding a global error handler and while being hacky, the signAndSend method never triggers the passed callback.
2024-12-06 15:41:45 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
2024-12-06 15:41:45 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
/project/node_modules/.pnpm/@[email protected]/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:23
throw new error_js_1.default(`${code}: ${message}${formatErrorData(data)}`, code, data);
^
RpcError: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
at checkError (/project/node_modules/.pnpm/@[email protected]/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:23:15)
at RpcCoder.decodeResponse (/project/node_modules/.pnpm/@[email protected]/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:39:9)
at WsProvider.__internal__onSocketMessageResult (/project/node_modules/.pnpm/@[email protected]/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:413:51)
at WebSocket.__internal__onSocketMessage (/project/node_modules/.pnpm/@[email protected]/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:402:20)
at callListener (/project/node_modules/.pnpm/[email protected]/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onMessage (/project/node_modules/.pnpm/[email protected]/node_modules/ws/lib/event-target.js:209:9)
at WebSocket.emit (node:events:519:28)
at Receiver.receiverOnMessage (/project/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1220:20)
at Receiver.emit (node:events:519:28)
at Receiver.dataMessage (/project/node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:596:14)
Node.js v20.17.0
The expected behavior is to catch correctly errors and have a correct callback trigger with the error inside.
What is the motivation for changing the behavior?
The app crashing on a so trivial error should be a pretty straightforward motivation.
Please tell us about your environment:
Version:
Environment:
Node.js
Browser
Other (limited support for other environments)
Language:
JavaScript
TypeScript: 5.6.3
Other
The text was updated successfully, but these errors were encountered:
TarikGul
added
the
Support
Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
label
Dec 9, 2024
When submitting a tx with an account that does not have sufficient gas for fee, an error is thrown but it is never catched by the calling functions so it ends up in an unhandled rejection error.
Since nodejs 15, the default behavior when an error like this arise is to exit the process with code 1. In other terms if I submit a transaction with not enough balance, my app crashes without asking anything.
This behavior can be prevented by adding a global error handler and while being hacky, the signAndSend method never triggers the passed callback.
The expected behavior is to catch correctly errors and have a correct callback trigger with the error inside.
The app crashing on a so trivial error should be a pretty straightforward motivation.
Version:
Environment:
Language:
The text was updated successfully, but these errors were encountered: