aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_errors.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-10-15 14:30:50 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-10-15 14:31:40 +0100
commite76dcdd8109c288c346e45a396839c94633b03cb (patch)
treed14386f0ba3dfc7789dfe9d8770f2defdcc930cd /src/wallet/wallet_errors.h
parentMerge pull request #1203 (diff)
downloadmonero-e76dcdd8109c288c346e45a396839c94633b03cb.tar.xz
wallet: improve error messages when not enough money for transfer
Diffstat (limited to 'src/wallet/wallet_errors.h')
-rw-r--r--src/wallet/wallet_errors.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h
index c5590d79c..93e7c2ec3 100644
--- a/src/wallet/wallet_errors.h
+++ b/src/wallet/wallet_errors.h
@@ -68,6 +68,7 @@ namespace tools
// transfer_error *
// get_random_outs_general_error
// not_enough_money
+ // tx_not_possible
// not_enough_outs_to_mix
// tx_not_constructed
// tx_rejected
@@ -351,6 +352,32 @@ namespace tools
: transfer_error(std::move(loc), "not enough money")
, m_available(availbable)
, m_tx_amount(tx_amount)
+ {
+ }
+
+ uint64_t available() const { return m_available; }
+ uint64_t tx_amount() const { return m_tx_amount; }
+
+ std::string to_string() const
+ {
+ std::ostringstream ss;
+ ss << transfer_error::to_string() <<
+ ", available = " << cryptonote::print_money(m_available) <<
+ ", tx_amount = " << cryptonote::print_money(m_tx_amount);
+ return ss.str();
+ }
+
+ private:
+ uint64_t m_available;
+ uint64_t m_tx_amount;
+ };
+ //----------------------------------------------------------------------------------------------------
+ struct tx_not_possible : public transfer_error
+ {
+ explicit tx_not_possible(std::string&& loc, uint64_t availbable, uint64_t tx_amount, uint64_t fee)
+ : transfer_error(std::move(loc), "tx not possible")
+ , m_available(availbable)
+ , m_tx_amount(tx_amount)
, m_fee(fee)
{
}