@@ -1622,7 +1622,11 @@ func (i *jsonAPIHandler) POSTOrderConfirmation(w http.ResponseWriter, r *http.Re
1622
1622
return
1623
1623
}
1624
1624
1625
- order , _ := i .node .GetOrder (conf .OrderID )
1625
+ order , err := i .node .GetOrder (conf .OrderID )
1626
+ if err != nil {
1627
+ ErrorResponse (w , http .StatusInternalServerError , err .Error ())
1628
+ return
1629
+ }
1626
1630
v5contract := order .Contract
1627
1631
1628
1632
contract , state , funded , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (conf .OrderID )
@@ -1791,7 +1795,11 @@ func (i *jsonAPIHandler) POSTRefund(w http.ResponseWriter, r *http.Request) {
1791
1795
}
1792
1796
1793
1797
// TODO: Remove once broken contracts are migrated
1794
- order , _ := i .node .GetOrder (can .OrderID )
1798
+ order , err := i .node .GetOrder (can .OrderID )
1799
+ if err != nil {
1800
+ ErrorResponse (w , http .StatusInternalServerError , err .Error ())
1801
+ return
1802
+ }
1795
1803
v5contract := order .Contract
1796
1804
1797
1805
lookupCoin := v5contract .BuyerOrder .Payment .AmountCurrency .Code
@@ -1994,7 +2002,11 @@ func (i *jsonAPIHandler) POSTOrderFulfill(w http.ResponseWriter, r *http.Request
1994
2002
}
1995
2003
1996
2004
// TODO: Remove once broken contracts are migrated
1997
- order , _ := i .node .GetOrder (fulfill .OrderId )
2005
+ order , err := i .node .GetOrder (fulfill .OrderId )
2006
+ if err != nil {
2007
+ ErrorResponse (w , http .StatusNotFound , "order not found" )
2008
+ return
2009
+ }
1998
2010
v5contract := order .Contract
1999
2011
2000
2012
lookupCoin := v5contract .BuyerOrder .Payment .AmountCurrency .Code
@@ -2223,7 +2235,11 @@ func (i *jsonAPIHandler) GETCase(w http.ResponseWriter, r *http.Request) {
2223
2235
}
2224
2236
2225
2237
if buyerContract .BuyerOrder .Payment .BigAmount == "" {
2226
- v5order , _ := repo .ToV5Order (buyerContract .BuyerOrder , nil )
2238
+ v5order , err := repo .ToV5Order (buyerContract .BuyerOrder , nil )
2239
+ if err != nil {
2240
+ ErrorResponse (w , http .StatusInternalServerError , err .Error ())
2241
+ return
2242
+ }
2227
2243
buyerContract .BuyerOrder = v5order
2228
2244
}
2229
2245
@@ -2342,7 +2358,12 @@ func (i *jsonAPIHandler) POSTReleaseEscrow(w http.ResponseWriter, r *http.Reques
2342
2358
}
2343
2359
2344
2360
// TODO: Remove once broken contracts are migrated
2345
- order , _ := i .node .GetOrder (rel .OrderID )
2361
+ order , err := i .node .GetOrder (rel .OrderID )
2362
+ if err != nil {
2363
+ ErrorResponse (w , http .StatusBadRequest , "Could not retrieve the order" )
2364
+ return
2365
+ }
2366
+
2346
2367
lookupCoin := order .Contract .BuyerOrder .Payment .AmountCurrency .Code
2347
2368
_ , err = i .node .LookupCurrency (lookupCoin )
2348
2369
if err != nil {
0 commit comments