You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/10/16 09:09:55 UTC

svn commit: r1398679 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java

Author: jleroux
Date: Tue Oct 16 07:09:54 2012
New Revision: 1398679

URL: http://svn.apache.org/viewvc?rev=1398679&view=rev
Log:
A Christoph Neuroth's idea "Include complete stack trace in groovy script exception messages" https://issues.apache.org/jira/browse/OFBIZ-5049

When a groovy script fails, currently you can only follow the stack trace to rg.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:348), but not into the failed script itself, which makes debugging really hard.

This can easily be improved by wrapping the exception there:

-            throw new IllegalArgumentException(errMsg);
+            throw new IllegalArgumentException(errMsg, e);


Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java?rev=1398679&r1=1398678&r2=1398679&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java Tue Oct 16 07:09:54 2012
@@ -345,7 +345,7 @@ public final class ScriptUtil {
         } catch (Exception e) {
             String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
             Debug.logWarning(e, errMsg, module);
-            throw new IllegalArgumentException(errMsg);
+            throw new IllegalArgumentException(errMsg, e);
         }
     }