I have a sql exception from clojure that goes like this:
java.lang.Exception: transaction rolled back:
Batch entry 0 drop database triface was aborted.
Call getNextException to see the cause.
I want to call getNextException on the exception I receive:
(require [clojure.contrib.sql :as sql])
(try
(db/rebuild-table) ;; function causing the exception
(catch Exception e (.getNextException e)))
But then I get this:
java.lang.IllegalArgumentException: No matching field found:
getNextException for class java.lang.Exception
So I assume I want to catch a SQLException:
(catch SQLException e (.getNextException e)))
Except I can’t find how to require this class. It does not seem to be provided by either clojure.contrib.sql or clojure.contrib.sql.internal. The javadocs say it is in java.sql, but how do I require that?
Thanks!
You don’t require it, you import it,
but even if you catch a Exception as long as it is a SQLException you should be able to call getNextException