Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add DbExecutionError and used in the mysql driver execution
天舟f6248b86dec0
diff --git a/common/error.go b/common/error.goindex 70e3dbf3da..9aa58cb4e6 100644--- a/common/error.go+++ b/common/error.go@@ -21,6 +21,7 @@ const (// 101 ~ 199 db errorDbConnectionFailure Code = 101DbStatementSyntaxError Code = 102+ DbExecutionError Code = 103)// Error represents an application-specific error. Application errors can bediff --git a/frontend/src/types/error.ts b/frontend/src/types/error.tsindex 837eaf2b03..9b9853aa16 100644--- a/frontend/src/types/error.ts+++ b/frontend/src/types/error.ts@@ -11,6 +11,7 @@ export enum GeneralErrorCode {export enum DBErrorCode {CONNECTION_ERROR = 101,SYNTAX_ERROR = 102,+ EXECUTION_ERROR = 103,}export type ErrorCode = GeneralErrorCode | DBErrorCode;diff --git a/plugin/db/mysql/mysql.go b/plugin/db/mysql/mysql.goindex 1285e57187..cddcee7056 100644--- a/plugin/db/mysql/mysql.go+++ b/plugin/db/mysql/mysql.go@@ -11,6 +11,7 @@ import ("strings""time"+ "github.com/bytebase/bytebase/common""github.com/bytebase/bytebase/plugin/db""github.com/go-sql-driver/mysql""go.uber.org/zap"@@ -856,7 +857,7 @@ func formatError(err error) error {}func formatErrorWithQuery(err error, query string) error {- return fmt.Errorf("failed to execute error: %w\n\nquery:\n%q", err, query)+ return common.Errorf(common.DbExecutionError, fmt.Sprintf("failed to execute error: %v\n\nquery:\n%q", err, query))}// Dump and restore