devopsdao / webthree

MIT License
7 stars 3 forks source link

Error not managed #20

Open redDwarf03 opened 6 months ago

redDwarf03 commented 6 months ago

packages/webthree/src/core/exception_utils_js.dart doesn't work with this error:

MetaMask - RPC Error: insufficient funds for gas * price + value: balance 73096693914490079, tx cost 88771594218000000, overshot 15674900303509921

FormatException: SyntaxError: Unexpected token 'i', "insufficie"... is not valid JSON, EVMBridgeProcessMixin - sendTransactionWithErrorManagement, dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:49  throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart 39:5           _parseJson
dart-sdk/lib/convert/json.dart 610:36                                         convert
dart-sdk/lib/convert/json.dart 216:41                                         decode
packages/webthree/src/core/exception_utils_js.dart 33:39                      analyzeException
packages/webthree/src/browser/metamask/dart_wrappers.dart 50:22               <fn>
dart-sdk/lib/async/future.dart 1069:25                                        onError
makinghappen commented 6 months ago

it looks like it is a non-standard RPC error returned in plain text, we have to handle such cases