Fixed helper functions in sample dapps for extracting the message of an error - WalletConnect has a habit of throwing errors with empty message, meaning that the error is erroneously type cast to a string.
Furthermore, on errors like "user rejected the request", WalletConnect throws the reject object (which is not an Error). This has worked until now because this object just happens to have a message field, so the function would "luckily" interpret it as Error and extract this message. This changes with this fix and the object will now just render as [object Object]. Passing err as string like before will fail because we're then trying to render an object which is not allowed in React.
TODO: For the sign-message sample, we bit the dust and use any for error instead of string. We should either see if the problem can be fixed generically or do the same for the contractupdate sample.
Fixed helper functions in sample dapps for extracting the message of an error - WalletConnect has a habit of throwing errors with empty message, meaning that the error is erroneously type cast to a string.
Furthermore, on errors like "user rejected the request", WalletConnect throws the reject object (which is not an
Error
). This has worked until now because this object just happens to have amessage
field, so the function would "luckily" interpret it asError
and extract this message. This changes with this fix and the object will now just render as[object Object]
. Passingerr
as string like before will fail because we're then trying to render an object which is not allowed in React.TODO: For the
sign-message
sample, we bit the dust and useany
for error instead ofstring
. We should either see if the problem can be fixed generically or do the same for thecontractupdate
sample.Partially(?) resolves CBW-1148.