From 5710d6c4fd10a985eb13ed65d34216a7b56e40cd Mon Sep 17 00:00:00 2001 From: yuanjiawei Date: Fri, 25 Oct 2024 10:57:40 +0800 Subject: [PATCH] fix: comments --- sqle/server/auditplan/task_type_mysql_processlist.go | 3 ++- sqle/server/auditplan/task_type_mysql_schema_meta.go | 3 ++- sqle/server/auditplan/task_type_oracle_topsql.go | 3 ++- sqle/server/pipeline/pipeline.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sqle/server/auditplan/task_type_mysql_processlist.go b/sqle/server/auditplan/task_type_mysql_processlist.go index afe1c15ac..794452044 100644 --- a/sqle/server/auditplan/task_type_mysql_processlist.go +++ b/sqle/server/auditplan/task_type_mysql_processlist.go @@ -3,6 +3,7 @@ package auditplan import ( "context" "fmt" + "github.com/actiontech/sqle/sqle/errors" "strconv" "time" @@ -82,7 +83,7 @@ func (at *MySQLProcessListTaskV2) ExtractSQL(logger *logrus.Entry, ap *AuditPlan return nil, fmt.Errorf("get instance fail, error: %v", err) } if !exist { - return nil, fmt.Errorf("instance: %v is not exist", ap.InstanceID) + return nil, errors.NewInstanceNoExistErr() } db, err := executor.NewExecutor(logger, &driverV2.DSN{ diff --git a/sqle/server/auditplan/task_type_mysql_schema_meta.go b/sqle/server/auditplan/task_type_mysql_schema_meta.go index 0c9dc7096..2511a6540 100644 --- a/sqle/server/auditplan/task_type_mysql_schema_meta.go +++ b/sqle/server/auditplan/task_type_mysql_schema_meta.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/actiontech/sqle/sqle/errors" "strconv" "time" @@ -52,7 +53,7 @@ func (at *BaseSchemaMetaTaskV2) extractSQL(logger *logrus.Entry, ap *AuditPlan, return nil, fmt.Errorf("get instance fail, error: %v", err) } if !exist { - return nil, fmt.Errorf("instance: %v is not exist", ap.InstanceID) + return nil, errors.NewInstanceNoExistErr() } db, err := executor.NewExecutor(logger, &driverV2.DSN{ Host: instance.Host, diff --git a/sqle/server/auditplan/task_type_oracle_topsql.go b/sqle/server/auditplan/task_type_oracle_topsql.go index e2474feb1..889122888 100644 --- a/sqle/server/auditplan/task_type_oracle_topsql.go +++ b/sqle/server/auditplan/task_type_oracle_topsql.go @@ -3,6 +3,7 @@ package auditplan import ( "context" "fmt" + "github.com/actiontech/sqle/sqle/errors" "strconv" "time" @@ -100,7 +101,7 @@ func (at *OracleTopSQLTaskV2) ExtractSQL(logger *logrus.Entry, ap *AuditPlan, pe return nil, fmt.Errorf("get instance fail, error: %v", err) } if !exist { - return nil, fmt.Errorf("instance: %v is not exist", ap.InstanceID) + return nil, errors.NewInstanceNoExistErr() } // This depends on: https://github.com/actiontech/sqle-oracle-plugin. // If your Oracle db plugin does not implement the parameter `service_name`, diff --git a/sqle/server/pipeline/pipeline.go b/sqle/server/pipeline/pipeline.go index 6fcdfabc2..88378d690 100644 --- a/sqle/server/pipeline/pipeline.go +++ b/sqle/server/pipeline/pipeline.go @@ -3,6 +3,7 @@ package pipeline import ( "context" "fmt" + "github.com/actiontech/sqle/sqle/errors" "net" "net/url" "time" @@ -46,7 +47,7 @@ func (node PipelineNode) IntegrationInfo(ctx context.Context, projectName string return "", err } if !exist { - return "", fmt.Errorf("instance: %v is not exist", node.InstanceID) + return "", errors.NewInstanceNoExistErr() } node.InstanceName = instance.Name }