diff --git a/src/common/error_codes.h b/src/common/error_codes.h index 2878c300..934ac3bc 100644 --- a/src/common/error_codes.h +++ b/src/common/error_codes.h @@ -11,6 +11,7 @@ #define API_RETURN_CODE_ACCESS_DENIED "ACCESS_DENIED" #define API_RETURN_CODE_INTERNAL_ERROR "INTERNAL_ERROR" #define API_RETURN_CODE_NOT_ENOUGH_MONEY "NOT_ENOUGH_MONEY" +#define API_RETURN_CODE_NOT_ENOUGH_OUTPUTS_FOR_MIXING "NOT_ENOUGH_OUTPUTS_FOR_MIXING" #define API_RETURN_CODE_INTERNAL_ERROR_QUE_FULL "INTERNAL_ERROR_QUE_FULL" #define API_RETURN_CODE_BAD_ARG "BAD_ARG" #define API_RETURN_CODE_BAD_ARG_EMPTY_DESTINATIONS "BAD_ARG_EMPTY_DESTINATIONS" @@ -21,7 +22,7 @@ #define API_RETURN_CODE_WRONG_PASSWORD "WRONG_PASSWORD" #define API_RETURN_CODE_WALLET_WRONG_ID "WALLET_WRONG_ID" #define API_RETURN_CODE_WALLET_WATCH_ONLY_NOT_SUPPORTED "WALLET_WATCH_ONLY_NOT_SUPPORTED" -#define API_RETURN_CODE_WALLET_AUDITABLE_NOT_SUPPORTED "WALLET_AUDITABLE_NOT_SUPPORTED" +#define API_RETURN_CODE_WALLET_AUDITABLE_NOT_SUPPORTED "WALLET_AUDITABLE_NOT_SUPPORTED" #define API_RETURN_CODE_FILE_NOT_FOUND "FILE_NOT_FOUND" #define API_RETURN_CODE_ALREADY_EXISTS "ALREADY_EXISTS" #define API_RETURN_CODE_CANCELED "CANCELED" diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp index 93b4fdd5..030b058d 100644 --- a/src/wallet/wallets_manager.cpp +++ b/src/wallet/wallets_manager.cpp @@ -1354,7 +1354,16 @@ std::string wallets_manager::transfer(size_t wallet_id, const view::transfer_par } } w->get()->transfer(dsts, tp.mixin_count, unlock_time ? unlock_time + 1 : 0, fee, extra, attachments, res_tx); - //update_wallets_info(); + } + catch (const tools::error::not_enough_money& e) + { + LOG_ERROR(get_wallet_log_prefix(wallet_id) + "Transfer error: not enough money: " << e.what()); + return API_RETURN_CODE_NOT_ENOUGH_MONEY; + } + catch (const tools::error::not_enough_outs_to_mix& e) + { + LOG_ERROR(get_wallet_log_prefix(wallet_id) + "Transfer error: not outs to mix: " << e.what()); + return API_RETURN_CODE_NOT_ENOUGH_OUTPUTS_FOR_MIXING; } catch (const std::exception& e) {