diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index f39169c193d3483e4db6a35aa42f5187ef1bf723..174610ec79fee83411e2ee92a79d073894fdb002 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -339,6 +339,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { const char* msg = (sub->cmd.command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"multi-tableMeta"; if (code != TSDB_CODE_SUCCESS) { tscError("0x%"PRIx64" get %s failed, code:%s", pSql->self, msg, tstrerror(code)); + if (code == TSDB_CODE_RPC_FQDN_ERROR) { + size_t sz = strlen(tscGetErrorMsgPayload(&sub->cmd)); + tscAllocPayload(&pSql->cmd, (int)sz + 1); + memcpy(tscGetErrorMsgPayload(&pSql->cmd), tscGetErrorMsgPayload(&sub->cmd), sz); + } goto _error; } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 3e8dfac1da0cb192282989b9ab1137427365b6d0..36cc2128687299a577fc2a1acaad56b70bde28c4 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -501,6 +501,15 @@ static void doProcessMsgFromServer(SSchedMsg* pSchedMsg) { pRes->code = rpcMsg->code; } rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? (int32_t)pRes->numOfRows : pRes->code; + if (pRes->code == TSDB_CODE_RPC_FQDN_ERROR) { + if (pEpSet) { + char buf[TSDB_FQDN_LEN + 64] = {0}; + tscAllocPayload(pCmd, sizeof(buf)); + sprintf(tscGetErrorMsgPayload(pCmd), "%s\"%s\"", tstrerror(pRes->code),pEpSet->fqdn[(pEpSet->inUse)%(pEpSet->numOfEps)]); + } else { + sprintf(tscGetErrorMsgPayload(pCmd), "%s", tstrerror(pRes->code)); + } + } (*pSql->fp)(pSql->param, pSql, rpcMsg->code); } diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 6f3d5c3a63c8d9c82eb7776c0a346abc88676ec1..5f55e1c50d3ef75d6036a7d71419f142bff8cfb9 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -196,6 +196,11 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, if (pSql->res.code != TSDB_CODE_SUCCESS) { terrno = pSql->res.code; + if (terrno ==TSDB_CODE_RPC_FQDN_ERROR) { + printf("taos connect failed, reason: %s\n\n", taos_errstr(pSql)); + } else { + printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno)); + } taos_free_result(pSql); taos_close(pObj); return NULL; @@ -643,7 +648,7 @@ char *taos_errstr(TAOS_RES *tres) { return (char*) tstrerror(terrno); } - if (hasAdditionalErrorInfo(pSql->res.code, &pSql->cmd)) { + if (hasAdditionalErrorInfo(pSql->res.code, &pSql->cmd) || pSql->res.code == TSDB_CODE_RPC_FQDN_ERROR) { return pSql->cmd.payload; } else { return (char*)tstrerror(pSql->res.code); diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 58f4b7ff02b673288878aa44671ba2a544556cc5..cdce61e578de729e09bd30e893b5f4e97a6128d8 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -98,7 +98,6 @@ TAOS *shellInit(SShellArguments *_args) { } if (con == NULL) { - printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno)); fflush(stdout); return con; }