diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 62052457fd61d8e0f408ef9c0d5cb0b5c6cc702d..b4c2615f703feb83096fad0b5b234337c2cf82d7 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -142,6 +142,7 @@ void taos_close(TAOS *taos) { int taos_errno(TAOS_RES *res) { if (res == NULL || TD_RES_TMQ_META(res)) { + if (terrno == TSDB_CODE_RPC_REDIRECT) errno = TSDB_CODE_RPC_NETWORK_UNAVAIL; return terrno; } @@ -149,11 +150,13 @@ int taos_errno(TAOS_RES *res) { return 0; } + if (pRequest->code == TSDB_CODE_RPC_REDIRECT) pRequest->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; return ((SRequestObj *)res)->code; } const char *taos_errstr(TAOS_RES *res) { if (res == NULL || TD_RES_TMQ_META(res)) { + if (terrno == TSDB_CODE_RPC_REDIRECT) errno = TSDB_CODE_RPC_NETWORK_UNAVAIL; return (const char *)tstrerror(terrno); } @@ -165,6 +168,7 @@ const char *taos_errstr(TAOS_RES *res) { if (NULL != pRequest->msgBuf && (strlen(pRequest->msgBuf) > 0 || pRequest->code == TSDB_CODE_RPC_FQDN_ERROR)) { return pRequest->msgBuf; } else { + if (pRequest->code == TSDB_CODE_RPC_REDIRECT) pRequest->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; return (const char *)tstrerror(pRequest->code); } }