code: private static boolean shouldRetry(JsonObject errorJson) {
          if (errorJson == null) return false;
          Integer code = errorJson.getInt(ERROR_FIELD_CODE);
          String msg = errorJson.getString(ERROR_FIELD_MSG);
  
          if (code == null || msg == null) return false;
  
          if (code == 4050 || code == 4070 ||
                  (code == 5000 && msg.contains(ERROR_5000_SPECIFIC_MESSAGE))) {
              return true;
          }
          return false;
      }
docs: Tests a N1QL error JSON for conditions warranting a prepared statement retry.