[bisq-network/bisq] Move Payment account creation and removal from UI to core (#3586)

chimp1984 notifications at github.com
Mon Nov 18 12:47:15 UTC 2019


chimp1984 commented on this pull request.



> +                                 TradeManager tradeManager,
+                                 User user) {
+        this.accountAgeWitnessService = accountAgeWitnessService;
+        this.altCoinAddressValidator = altCoinAddressValidator;
+        this.openOfferManager = openOfferManager;
+        this.preferences = preferences;
+        this.tradeManager = tradeManager;
+        this.user = user;
+    }
+
+    public PaymentAccount addPaymentAccount(PaymentAccount paymentAccount) {
+        if (paymentAccount instanceof CryptoCurrencyAccount) {
+            CryptoCurrencyAccount cryptoCurrencyAccount = (CryptoCurrencyAccount) paymentAccount;
+            TradeCurrency tradeCurrency = cryptoCurrencyAccount.getSingleTradeCurrency();
+            if (tradeCurrency == null) {
+                throw new ValidationException("CryptoCurrency account must have exactly one trade currency");

Policy in Bisq is to use exceptions for exceptional cases. If a field can be null we use null checks or `Optional` but we do not throw an exception. Only if a fields is expected to be not null we use `checkNotNull` which throws an exception. I know there are different philosophies how to deal with exceptions but I think it is not a good idea to start to mix 2 different philosophies when the projects is using already one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3586#discussion_r347360391
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191118/470bae57/attachment-0001.html>


More information about the bisq-github mailing list