Display wallet response error if available

This commit improves error handling in the wallet's "send" feature, by
displaying more specific wallet response error messages when available.

Closes: https://github.com/damus-io/damus/issues/3095
Changelog-Fixed: Improve error handling on wallet send feature
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2025-06-20 18:30:52 -07:00
parent 2c62741e25
commit 8d9f728cf0

View File

@@ -217,6 +217,10 @@ struct SendPaymentView: View {
))
}
}
else if let error = error as? WalletConnect.WalletResponseErr,
let humanReadableError = error.humanReadableError {
sendState = .failed(error: humanReadableError)
}
else {
sendState = .failed(error: .init(
user_visible_description: NSLocalizedString("An unexpected error occurred.", comment: "A human-readable error message"),