I am doing error handling in an app using polkadotJSAPI 7.13.1 There are two ways to fetch info if an extrinsic succeeds or fails, the first one is via dispatchError in signAndSend like so

transferExtrinsic.signAndSend(account_from, { signer: injector.signer }, ({ status, events, dispatchError }) => {

The second is described in docs

Both generally work for most extrinsics, but not for transferExtrinsic = api.tx.balances.transfer(account_to, (amount));, for example when trying to send more tokens than exists in a wallet. Both approaches give either DispatchError = undefined or doesn't find an event with extrinsicfailed. PolkadotJS web interface catches the error correctly. How do I check if any extrinsic succeeds or errors out, including balances.transfer extrinsic?

  • I'm facing an issue that When I'm using tx.utility.batchAll() The message error has come. But it has just a message thrown 1-2s after the transaction is successful. I thought the transaction must be blocked and rollback but it didn't. Apr 7, 2023 at 4:11

2 Answers 2


You can wrap the code in a try-catch block:

   await transferExtrinsic.signAndSend(injector.signer); 
catch(error: any){
    const errorMessage = error.toString();

And in the catch you get the error message, in your case you will get:

RpcError: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
  • Thanks but, that too unfortunately, doesnt work universally. The extrinsic doesnt error out in js if it errors out on chain, for example when sending more tokens than you have in a wallet Jan 20, 2023 at 18:46

Solved it by updating polkadotJSApi to v9, dispatchError seems to work in all cases in that version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.