Skip to content

Commit 76dc547

Browse files
committed
gui: create tx, launch error dialog if backend throws runtime_error
only will ever happen if something unexpected happened.
1 parent f4d7947 commit 76dc547

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/qt/walletmodel.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
212212
return AmountExceedsBalance;
213213
}
214214

215-
{
215+
try {
216216
CAmount nFeeRequired = 0;
217217
int nChangePosRet = -1;
218218

@@ -240,6 +240,11 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
240240
if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) {
241241
return AbsurdFee;
242242
}
243+
} catch (const std::runtime_error& err) {
244+
// Something unexpected happened, instruct user to report this bug.
245+
Q_EMIT message(tr("Send Coins"), QString::fromStdString(err.what()),
246+
CClientUIInterface::MSG_ERROR);
247+
return TransactionCreationFailed;
243248
}
244249

245250
return SendCoinsReturn(OK);

0 commit comments

Comments
 (0)