Author: davsclaus
Date: Mon May  5 22:14:33 2008
New Revision: 653679

URL: http://svn.apache.org/viewvc?rev=653679&view=rev
Log:
CAMEL-84: improved error message for exception

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java?rev=653679&r1=653678&r2=653679&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
 Mon May  5 22:14:33 2008
@@ -26,27 +26,36 @@
     private final Class type;
 
     public NoTypeConversionAvailableException(Object value, Class type) {
-        super("No converter available to convert value: " + value + " to the 
required type: "
-              + type.getName());
+        super("No type converter available to convert from type: " + (value != 
null ? value.getClass() : null) +
+            " to the required type " + type.getName() + " with value " + 
value);
         this.value = value;
         this.type = type;
     }
 
     /**
      * Returns the value which could not be converted
-     * 
-     * @return the value that could not be converted
      */
     public Object getValue() {
         return value;
     }
 
     /**
-     * Returns the required type
-     * 
-     * @return the required type
+     * Returns the required <tt>to</tt> type
      */
     public Class getType() {
         return type;
     }
+
+    /**
+     * Returns the required <tt>from</tt> type.
+     * Returns <tt>null</tt> if the provided value was null.
+     */
+    public Class getFromType() {
+        if (value != null) {
+            return value.getClass();
+        } else {
+            return null;
+        }
+    }
+
 }


Reply via email to