public static InternalException convertToInternal(Exception e) { return new InternalException(e); }
public static SQLException convert(Throwable e) { if (e instanceof InternalException) { e = ((InternalException) e).getOriginalCause(); } if (e instanceof SQLException) { return (SQLException) e; } else if (e instanceof InvocationTargetException) { InvocationTargetException te = (InvocationTargetException) e; Throwable t = te.getTargetException(); if (t instanceof SQLException) { return (SQLException) t; } return getSQLException(ErrorCode.EXCEPTION_IN_FUNCTION, null, e); } else if (e instanceof IOException) { return getSQLException(ErrorCode.IO_EXCEPTION_1, new String[] { e.toString() }, e); } return getSQLException(ErrorCode.GENERAL_ERROR_1, new String[]{e.toString()}, e); }