camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r673444 - /activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Date Wed, 02 Jul 2008 17:14:02 GMT
Author: ammulder
Date: Wed Jul  2 10:14:01 2008
New Revision: 673444

URL: http://svn.apache.org/viewvc?rev=673444&view=rev
Log:
Special handling for JRuby exceptions to display the actual error message

Modified:
    activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java

Modified: activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java?rev=673444&r1=673443&r2=673444&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
(original)
+++ activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Wed Jul  2 10:14:01 2008
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.lang.reflect.InvocationTargetException;
 
 import javax.script.Compilable;
 import javax.script.CompiledScript;
@@ -526,6 +527,12 @@
     }
 
     protected ScriptEvaluationException createScriptEvaluationException(Throwable e) {
+        if(e.getClass().getName().equals("org.jruby.exceptions.RaiseException")) { // Only
the nested exception has the specific problem
+            try {
+                Object ex = e.getClass().getMethod("getException").invoke(e);
+                return new ScriptEvaluationException("Failed to evaluate: " + getScriptDescription()
+ ".  Error: "+ex+". Cause: "+e, e);
+            } catch (Exception e1) {}
+        }
         return new ScriptEvaluationException("Failed to evaluate: " + getScriptDescription()
+ ". Cause: " + e, e);
     }
 



Mime
View raw message