diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2022-12-15 10:19:23 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2022-12-21 23:20:17 -0300 |
commit | 76dc547ee7b05864e7b1b6c55fc0301d47aa3a15 (patch) | |
tree | c7bee2e7988521a1ce02a731ece8caf8677711fa /src/qt/walletmodel.cpp | |
parent | f4d79477ff0946b0bd340ade9251fa38e3b95dd7 (diff) |
gui: create tx, launch error dialog if backend throws runtime_error
only will ever happen if something unexpected happened.
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r-- | src/qt/walletmodel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index ed0602594b..b1bc78218c 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -212,7 +212,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact return AmountExceedsBalance; } - { + try { CAmount nFeeRequired = 0; int nChangePosRet = -1; @@ -240,6 +240,11 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) { return AbsurdFee; } + } catch (const std::runtime_error& err) { + // Something unexpected happened, instruct user to report this bug. + Q_EMIT message(tr("Send Coins"), QString::fromStdString(err.what()), + CClientUIInterface::MSG_ERROR); + return TransactionCreationFailed; } return SendCoinsReturn(OK); |