OSDN Git Service

error handle for empty utxo information
authorZhiting Lin <zlin035@uottawa.ca>
Wed, 20 Feb 2019 03:29:15 +0000 (11:29 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Wed, 20 Feb 2019 03:29:15 +0000 (11:29 +0800)
src/components/layout/profit/action.js
src/components/layout/save/action.js

index 5a382b4..39b5217 100644 (file)
@@ -10,9 +10,8 @@ export function FixedLimitProfit(account, amountBill, saver) {
       "asset": GetContractArgs().assetDeposited
     }).then(resp => {
 
-      if(resp.length === 0) {
+      if(!resp) {
         throw 'cannot load UTXO info.'
-        return
       }
 
       const capitalAmount = resp.amount
index e1f6ab5..19ec4fa 100644 (file)
@@ -11,6 +11,10 @@ export function FixedLimitDeposit(account, amount, address) {
       "program": GetContractArgs().depositProgram,
       "asset": GetContractArgs().assetBill
     }).then(resp => {
+      if(!resp) {
+        throw 'cannot load UTXO info.'
+      }
+
       const billAmount = resp.amount
       const billAsset = resp.asset
       const utxo = resp.hash