MobileWalletProtocol/wallet-mobile-sdk

Bug: Can't enumerate over MWPError as the struct is not public

titlesxyz opened this issue · 1 comments

Describe the bug

We can't access MWPError as it's not public

Steps

Using the following code it's impossible to parse over the different type of MWPErrors to show different error messages to the user.

     MWPClient.getInstance(to: .coinbaseWallet)?.initiateHandshake(initialActions: [
                Action(jsonRpc: .personal_sign(address: "", message: "Please sign this message to verify your wallet"))
        ], onResponse: { [weak self] result, account in
            switch result {
            case .success(let response):
                // success

            case .failure(let error):
                switch error {
                case CoinbaseWalletSDK.MWPError.walletReturnedError(let returnedError):
                    switch returnedError {
                    case "User denied request":
                        // show specific error message to user

                    default:
                        // handle failure
                    }

                default:
                    // handle failure
                }
            }
        })

Expected behavior

Ideally we have public access to MWPError so that we can smartly parse the errors and show specific error messages depending on the specific issue.

Version

1.0.3

Additional info

No response

Desktop

  • OS: iOS 17

Smartphone

No response

Thanks for posting. We will look into this