return (SQLException) thrownException;
}
if (thrownException instanceof StandardException) {
StandardException se = (StandardException) thrownException;
if (se.getCause() == null) {
// se is a single, unchained exception. Just convert it to an
// SQLException.
return Util.generateCsSQLException(se);
}
// se contains a non-empty exception chain. We want to put all of
// the exceptions (including Java exceptions) in the next-exception
// chain. Therefore, call wrapInSQLException() recursively to
// convert the cause chain into a chain of SQLExceptions.
return Util.seeNextException(se.getMessageId(),
se.getArguments(), wrapInSQLException(se.getCause()));
}
// thrownException is a Java exception
return Util.javaException(thrownException);
}