Merge pull request #14984 from taosdata/refactor/changeRetError
enh: change redirect to network_unavail
This commit is contained in:
commit
fe31b4b4fb
|
@ -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) terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -149,11 +150,13 @@ int taos_errno(TAOS_RES *res) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
return ((SRequestObj *)res)->code;
|
||||
return ((SRequestObj *)res)->code == TSDB_CODE_RPC_REDIRECT ? TSDB_CODE_RPC_NETWORK_UNAVAIL
|
||||
: ((SRequestObj *)res)->code;
|
||||
}
|
||||
|
||||
const char *taos_errstr(TAOS_RES *res) {
|
||||
if (res == NULL || TD_RES_TMQ_META(res)) {
|
||||
if (terrno == TSDB_CODE_RPC_REDIRECT) terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
||||
return (const char *)tstrerror(terrno);
|
||||
}
|
||||
|
||||
|
@ -165,7 +168,8 @@ 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 {
|
||||
return (const char *)tstrerror(pRequest->code);
|
||||
return pRequest->code == TSDB_CODE_RPC_REDIRECT ? (const char *)tstrerror(TSDB_CODE_RPC_NETWORK_UNAVAIL)
|
||||
: (const char *)tstrerror(pRequest->code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue