feat: add error code to show

This commit is contained in:
Alex Duan 2024-11-28 10:24:22 +08:00
parent 7f9a3bf9de
commit cf18ffe4ce
1 changed files with 4 additions and 2 deletions

View File

@ -1091,7 +1091,7 @@ void shellCleanupHistory() {
void shellPrintError(TAOS_RES *tres, int64_t st) { void shellPrintError(TAOS_RES *tres, int64_t st) {
int64_t et = taosGetTimestampUs(); int64_t et = taosGetTimestampUs();
fprintf(stderr, "\r\nDB error: %s (%.6fs)\r\n", taos_errstr(tres), (et - st) / 1E6); fprintf(stderr, "\r\nDB error: %s[%08X] (%.6fs)\r\n", taos_errstr(tres), taos_errno(tres), (et - st) / 1E6);
taos_free_result(tres); taos_free_result(tres);
} }
@ -1303,6 +1303,8 @@ int32_t shellExecute() {
#ifdef WEBSOCKET #ifdef WEBSOCKET
if (shell.args.restful || shell.args.cloud) { if (shell.args.restful || shell.args.cloud) {
if (shell_conn_ws_server(1)) { if (shell_conn_ws_server(1)) {
printf("failed to connect to server, error code:0x08x reason: %s\n", ws_errno(NULL), ws_errstr(NULL));
fflush(stdout);
return -1; return -1;
} }
} else { } else {
@ -1314,7 +1316,7 @@ int32_t shellExecute() {
} }
if (shell.conn == NULL) { if (shell.conn == NULL) {
printf("failed to connect to server, reason: %s\n", taos_errstr(NULL)); printf("failed to connect to server, reason: %s[%0x08x]\n",taos_errstr(NULL), taos_errno(NULL));
fflush(stdout); fflush(stdout);
return -1; return -1;
} }