enh: add three code show detail info

This commit is contained in:
Alex Duan 2024-11-28 14:23:39 +08:00
parent 8c3a5e2464
commit 28a2dea8fd
4 changed files with 8 additions and 5 deletions

View File

@ -48,6 +48,7 @@
#define SHELL_FLOAT_WIDTH 20
#define SHELL_DOUBLE_WIDTH 25
#define ERROR_CODE_DETAIL "\r\n\r\nView possible causes and suggested actions for error codes: \r\n https://docs.taosdata.com/reference/error-code/\r\n"
typedef struct {
char* hist[SHELL_MAX_HISTORY_SIZE];
char file[TSDB_FILENAME_LEN];

View File

@ -92,8 +92,8 @@ void shellPrintHelp() {
#else
printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com");
#endif
printf("%s", ERROR_CODE_DETAIL);
}
#ifdef LINUX
#include <argp.h>
#ifdef _ALPINE
@ -104,9 +104,9 @@ void shellPrintHelp() {
const char *argp_program_version = td_version;
#ifdef CUS_EMAIL
const char *argp_program_bug_address = CUS_EMAIL;
const char *argp_program_bug_address = CUS_EMAIL"ERROR_CODE_DETAIL;
#else
const char *argp_program_bug_address = "support@taosdata.com";
const char *argp_program_bug_address = "support@taosdata.com "ERROR_CODE_DETAIL;
#endif
static struct argp_option shellOptions[] = {

View File

@ -662,6 +662,7 @@ void showHelp() {
now - current time \n\
Example : \n\
select * from t1 where ts > now - 2w + 3d and ts <= now - 1w -2h ;\n");
printf(ERROR_CODE_DETAIL);
printf("\n");
}

View File

@ -1303,7 +1303,8 @@ int32_t shellExecute() {
#ifdef WEBSOCKET
if (shell.args.restful || shell.args.cloud) {
if (shell_conn_ws_server(1)) {
printf("failed to connect to server, code:0x08X %s\n", ws_errno(NULL), ws_errstr(NULL));
printf("failed to connect to server, code:0x%08X %s\n%s", ws_errno(NULL), ws_errstr(NULL), ERROR_CODE_DETAIL);
printf(ERROR_CODE_DETAIL);
fflush(stdout);
return -1;
}
@ -1316,7 +1317,7 @@ int32_t shellExecute() {
}
if (shell.conn == NULL) {
printf("failed to connect to server, code:0x%08X %s\n", taos_errno(NULL), taos_errstr(NULL));
printf("failed to connect to server, code:0x%08X %s\n%s", taos_errno(NULL), taos_errstr(NULL), ERROR_CODE_DETAIL);
fflush(stdout);
return -1;
}