multiversx / mx-sdk-js-extension-provider

Signing provider for dApps: DeFi Wallet (browser extension).
Other
1 stars 3 forks source link

improve errors handling #22

Open juliancwirko opened 6 months ago

juliancwirko commented 6 months ago

There could be a better way to improve that. Maybe on the message event listeners' side, but this change makes the errors more readable.

  1. Change the main message to 'Transaction failed' instead of 'Transaction canceled,' which is more general
  2. Spread the try catch also for startBgrMsgChannel Promise
  3. Catch the extensionResponse when it is not an array of transactions. When someone cancels the process.

Instead:

Transaction canceled: extensionResponse.map is not a function.

We now have:

Transaction failed: CanceledError.