QueryUtil { public static String makeErrorMsgUserFriendly(Throwable e) { String msg = e.getMessage(); Throwable cause = e; while (cause != null) { if (cause.getClass().getName().contains("ParseException")) { msg = cause.getMessage(); break; } if (cause.getClass().getName().contains("ArithmeticException")) { msg = "ArithmeticException: " + cause.getMessage(); break; } if (cause.getClass().getName().contains("NumberFormatException")) { msg = "NumberFormatException: " + cause.getMessage(); break; } cause = cause.getCause(); } return makeErrorMsgUserFriendly(msg); } private  QueryUtil(); static String appendLimitOffsetToSql(String sql, int limit, int offset); @Deprecated static String massageSql(String sql, String project, int limit, int offset, String defaultSchema); static String massageSql(String sql, String project, int limit, int offset, String defaultSchema,
            String catalog); static String makeErrorMsgUserFriendly(Throwable e); static String makeErrorMsgUserFriendly(String errorMsg); static boolean isSelectStatement(String sql); static String removeCommentInSql(String sql1);  }
@Test public void testUnknownErrorResponseMessage() { String msg = QueryUtil.makeErrorMsgUserFriendly(new NullPointerException()); Assert.assertEquals("Unknown error.", msg); }