fcl-js
fcl-js copied to clipboard
PKG -- [fcl-core] Add `TransactionError` type to better expose execution errors
closes #1891
This helps expose errors in a more usable way for developers. They can now check the error code against a standardized set of enums to help them categorize errors better. This utility can also be used by wallet developers to surface failed transaction results to users.
I tried to make this implementation as change-proof as possible (doesn't edit the message/extract error message, code is optional, regex uses first occurance instead of start of string) because there are existing tickets in flow-go which aim to improve error reporting, so it's best to err on the side of caution and assume that this could change.
see: https://github.com/onflow/flow-go/issues/3781 https://github.com/onflow/cadence/issues/2689