svn commit: r567520 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r567520 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

jonesde
Author: jonesde
Date: Sun Aug 19 19:02:50 2007
New Revision: 567520

URL: http://svn.apache.org/viewvc?rev=567520&view=rev
Log:
Changed to pass on and log more information related to errors; had some problems in code using this code that were masked by insufficient information

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=567520&r1=567519&r2=567520&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sun Aug 19 19:02:50 2007
@@ -109,7 +109,7 @@
             }
         }
         if (this.orderHeader == null) {
-            throw new IllegalArgumentException("Order header is not valid");
+            throw new IllegalArgumentException("Order header passed in is not valid for orderId [" + orderHeader.getString("orderId") + "]");
         }
     }
 
@@ -126,7 +126,12 @@
         try {
             this.orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
         } catch (GenericEntityException e) {
-            throw new IllegalArgumentException("Invalid orderId");
+            String errMsg = "Error finding order with ID [" + orderId + "]: " + e.toString();
+            Debug.logError(e, errMsg, module);
+            throw new IllegalArgumentException(errMsg);
+        }
+        if (this.orderHeader == null) {
+            throw new IllegalArgumentException("Order not found with orderId [" + orderId + "]");
         }
     }
 
@@ -156,7 +161,7 @@
             GenericValue productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId));
             return productStore;
         } catch (GenericEntityException ex) {
-            Debug.logError("Failed to get product store for order header [" + orderHeader + "] due to exception "+ ex.getMessage(), module);
+            Debug.logError(ex, "Failed to get product store for order header [" + orderHeader + "] due to exception "+ ex.getMessage(), module);
             return null;
         }
     }