presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/util/DatabaseUtil.java/DatabaseUtil/sqlCodeStartsWith
class DatabaseUtil:    private static boolean sqlCodeStartsWith(Exception e, String code)
    {
        for (Throwable throwable : Throwables.getCausalChain(e)) {
            if (throwable instanceof SQLException) {
                String state = ((SQLException) throwable).getSQLState();
                if (state != null && state.startsWith(code)) {
                    return true;
                }
            }
        }
        return false;
    }