Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: improve error message in english style (#1624)

Yilong Lida250fb2d196
diff --git a/api/policy.go b/api/policy.go
index 353f4fc365..3770998b1e 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -131,7 +131,7 @@ func (pa PipelineApprovalPolicy) String() (string, error) {
func UnmarshalPipelineApprovalPolicy(payload string) (*PipelineApprovalPolicy, error) {
var pa PipelineApprovalPolicy
if err := json.Unmarshal([]byte(payload), &pa); err != nil {
- return nil, fmt.Errorf("failed to unmarshal pipeline approval policy %q, error[%w]", payload, err)
+ return nil, fmt.Errorf("failed to unmarshal pipeline approval policy %q, error: %w", payload, err)
}
return &pa, nil
}
diff --git a/plugin/db/mysql/dump.go b/plugin/db/mysql/dump.go
index bcf1b0e5ac..3431e318d9 100644
--- a/plugin/db/mysql/dump.go
+++ b/plugin/db/mysql/dump.go
@@ -229,7 +229,7 @@ func dumpTxn(ctx context.Context, txn *sql.Tx, database string, out io.Writer, s
// Table and view statement.
tables, err := GetTablesTx(txn, dbName)
if err != nil {
- return fmt.Errorf("failed to get tables of database %q, error[%w]", dbName, err)
+ return fmt.Errorf("failed to get tables of database %q, error: %w", dbName, err)
}
for _, tbl := range tables {
if schemaOnly && tbl.TableType == baseTableType {
diff --git a/plugin/restore/mysql/mysql.go b/plugin/restore/mysql/mysql.go
index 3e1cc9d644..0039a1ad41 100644
--- a/plugin/restore/mysql/mysql.go
+++ b/plugin/restore/mysql/mysql.go
@@ -138,10 +138,10 @@ func (r *Restore) replayBinlog(ctx context.Context, originalDatabase, pitrDataba
mysqlCmd.Stdin = mysqlRead
if err := mysqlbinlogCmd.Start(); err != nil {
- return fmt.Errorf("cannot start mysqlbinlog command, error [%w]", err)
+ return fmt.Errorf("cannot start mysqlbinlog command, error: %w", err)
}
if err := mysqlCmd.Run(); err != nil {
- return fmt.Errorf("mysql command fails, error [%w]", err)
+ return fmt.Errorf("mysql command fails, error: %w", err)
}
if err := mysqlbinlogCmd.Wait(); err != nil {
return fmt.Errorf("error occurred while waiting for mysqlbinlog to exit: %w", err)
@@ -194,7 +194,7 @@ func (r *Restore) RestorePITR(ctx context.Context, fullBackup *bufio.Scanner, st
}
if err := r.replayBinlog(ctx, database, pitrDatabaseName, startBinlogInfo, targetTs); err != nil {
- return fmt.Errorf("failed to replay binlog, error[%w]", err)
+ return fmt.Errorf("failed to replay binlog, error: %w", err)
}
return nil
@@ -204,7 +204,7 @@ func (r *Restore) RestorePITR(ctx context.Context, fullBackup *bufio.Scanner, st
func getBinlogReplayList(startBinlogInfo api.BinlogInfo, binlogDir string) ([]string, error) {
startBinlogSeq, err := getBinlogNameSeq(startBinlogInfo.FileName)
if err != nil {
- return nil, fmt.Errorf("cannot parse the start binlog file name[%s], error[%w]", startBinlogInfo.FileName, err)
+ return nil, fmt.Errorf("cannot parse the start binlog file name %q, error: %w", startBinlogInfo.FileName, err)
}
binlogFiles, err := ioutil.ReadDir(binlogDir)
@@ -234,7 +234,7 @@ func getBinlogReplayList(startBinlogInfo api.BinlogInfo, binlogDir string) ([]st
if binlogFilesToReplaySorted[0].Seq != startBinlogSeq {
log.Error("The starting binlog file does not exist locally", zap.String("filename", startBinlogInfo.FileName))
- return nil, fmt.Errorf("the starting binlog file[%s] does not exist locally", startBinlogInfo.FileName)
+ return nil, fmt.Errorf("the starting binlog file %q does not exist locally", startBinlogInfo.FileName)
}
if !binlogFilesAreContinuous(binlogFilesToReplaySorted) {
@@ -280,12 +280,12 @@ func (r *Restore) parseLocalBinlogEventTimestamp(ctx context.Context, binlogInfo
if err := cmd.Run(); err != nil {
log.Error("mysqlbinlog command fails", zap.String("cmd", cmd.String()), zap.Error(err))
- return 0, fmt.Errorf("mysqlbinlog command[%s] fails, error[%w]", cmd.String(), err)
+ return 0, fmt.Errorf("mysqlbinlog command %q fails, error: %w", cmd.String(), err)
}
timestamp, err := parseBinlogEventTimestampImpl(buf.String())
if err != nil {
- return timestamp, fmt.Errorf("failed to parse binlog event timestamp, filename[%s], position[%d], error[%w]", binlogInfo.FileName, binlogInfo.Position, err)
+ return timestamp, fmt.Errorf("failed to parse binlog event timestamp, filename %q, position %d, error: %w", binlogInfo.FileName, binlogInfo.Position, err)
}
return timestamp, nil
@@ -401,7 +401,7 @@ func (r *Restore) SwapPITRDatabase(ctx context.Context, database string, suffixT
log.Debug("Check database exists", zap.String("database", database))
dbExists, err := r.databaseExists(ctx, database)
if err != nil {
- return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to check whether database %q exists, error[%w]", database, err)
+ return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to check whether database %q exists, error: %w", database, err)
}
// We use a connection to ensure that the following database write operations are in the same MySQL session.
@@ -419,17 +419,17 @@ func (r *Restore) SwapPITRDatabase(ctx context.Context, database string, suffixT
if !dbExists {
log.Debug("Database does not exist, creating...", zap.String("database", database))
if _, err := conn.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE `%s`", database)); err != nil {
- return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to create non-exist database %q, error[%w]", database, err)
+ return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to create non-exist database %q, error: %w", database, err)
}
}
tables, err := mysql.GetTables(ctx, db, database)
if err != nil {
- return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to get tables of database %q, error[%w]", database, err)
+ return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to get tables of database %q, error: %w", database, err)
}
tablesPITR, err := mysql.GetTables(ctx, db, pitrDatabaseName)
if err != nil {
- return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to get tables of database %q, error[%w]", pitrDatabaseName, err)
+ return pitrDatabaseName, pitrOldDatabase, fmt.Errorf("failed to get tables of database %q, error: %w", pitrDatabaseName, err)
}
if len(tables) == 0 && len(tablesPITR) == 0 {
@@ -538,7 +538,7 @@ func (r *Restore) downloadBinlogFilesOnServer(ctx context.Context, binlogFilesLo
if !existLocal {
if err := r.downloadBinlogFile(ctx, fileOnServer, fileOnServer.Name == latestBinlogFileOnServer.Name); err != nil {
log.Error("Failed to download binlog file", zap.String("path", path), zap.Error(err))
- return fmt.Errorf("failed to download binlog file[%s], error[%w]", path, err)
+ return fmt.Errorf("failed to download binlog file %q, error: %w", path, err)
}
} else if fileLocal.Size != fileOnServer.Size {
log.Debug("Deleting inconsistent local binlog file",
@@ -547,11 +547,11 @@ func (r *Restore) downloadBinlogFilesOnServer(ctx context.Context, binlogFilesLo
zap.Int64("sizeOnServer", fileOnServer.Size))
if err := os.Remove(path); err != nil {
log.Error("Failed to remove inconsistent local binlog file", zap.String("path", path), zap.Error(err))
- return fmt.Errorf("failed to remove inconsistent local binlog file[%s], error[%w]", path, err)
+ return fmt.Errorf("failed to remove inconsistent local binlog file %q, error: %w", path, err)
}
if err := r.downloadBinlogFile(ctx, fileOnServer, fileOnServer.Name == latestBinlogFileOnServer.Name); err != nil {
log.Error("Failed to re-download inconsistent local binlog file", zap.String("path", path), zap.Error(err))
- return fmt.Errorf("failed to re-download inconsistent local binlog file[%s], error[%w]", path, err)
+ return fmt.Errorf("failed to re-download inconsistent local binlog file %q, error: %w", path, err)
}
}
}
@@ -574,7 +574,7 @@ func (r *Restore) FetchAllBinlogFiles(ctx context.Context) error {
// Read the local binlog files.
binlogFilesLocalSorted, err := GetSortedLocalBinlogFiles(r.binlogDir)
if err != nil {
- return fmt.Errorf("failed to read local binlog files, error[%w]", err)
+ return fmt.Errorf("failed to read local binlog files, error: %w", err)
}
return r.downloadBinlogFilesOnServer(ctx, binlogFilesLocalSorted, binlogFilesOnServerSorted)
@@ -618,7 +618,7 @@ func (r *Restore) downloadBinlogFile(ctx context.Context, binlogFileToDownload B
fileInfo, err := os.Stat(resultFilePath)
if err != nil {
_ = os.Remove(resultFilePath)
- return fmt.Errorf("cannot get file[%s] stat, error[%w]", resultFilePath, err)
+ return fmt.Errorf("cannot get file %q stat, error: %w", resultFilePath, err)
}
if isLast {
// Case 1: It's the last binlog file we need (contains the targetTs).
@@ -631,7 +631,7 @@ func (r *Restore) downloadBinlogFile(ctx context.Context, binlogFileToDownload B
zap.Int64("downloadedSize", fileInfo.Size()),
)
_ = os.Remove(resultFilePath)
- return fmt.Errorf("downloaded latest binlog file[%s] size[%d] is smaller than size[%d] queried on MySQL server earlier", resultFilePath, fileInfo.Size(), binlogFileToDownload.Size)
+ return fmt.Errorf("downloaded latest binlog file %q size[%d] is smaller than size[%d] queried on MySQL server earlier", resultFilePath, fileInfo.Size(), binlogFileToDownload.Size)
}
} else {
// Case 2: It's an archived binlog file, and we must ensure the file size equals what we queried from the MySQL server earlier.
@@ -642,7 +642,7 @@ func (r *Restore) downloadBinlogFile(ctx context.Context, binlogFileToDownload B
zap.Int64("downloadedSize", fileInfo.Size()),
)
_ = os.Remove(resultFilePath)
- return fmt.Errorf("downloaded binlog file[%s] size[%d] is not equal to size[%d] queried on MySQL server earlier", resultFilePath, fileInfo.Size(), binlogFileToDownload.Size)
+ return fmt.Errorf("downloaded binlog file %q size[%d] is not equal to size[%d] queried on MySQL server earlier", resultFilePath, fileInfo.Size(), binlogFileToDownload.Size)
}
}
@@ -685,7 +685,7 @@ func (r *Restore) GetSortedBinlogFilesMetaOnServer(ctx context.Context) ([]Binlo
func getBinlogNameSeq(name string) (int64, error) {
s := strings.Split(name, ".")
if len(s) != 2 {
- return 0, fmt.Errorf("failed to parse binlog extension, expecting two parts in the binlog file name[%s] but get %d", name, len(s))
+ return 0, fmt.Errorf("failed to parse binlog extension, expecting two parts in the binlog file name %q but got %d", name, len(s))
}
return strconv.ParseInt(s[1], 10, 0)
}
diff --git a/resources/mysqlutil/mysqlutil.go b/resources/mysqlutil/mysqlutil.go
index 0300c9b952..81379b343f 100644
--- a/resources/mysqlutil/mysqlutil.go
+++ b/resources/mysqlutil/mysqlutil.go
@@ -71,7 +71,7 @@ func Install(resourceDir string) (*Instance, error) {
case runtime.GOOS == "linux" && runtime.GOARCH == "amd64":
tarName = "mysqlutil-8.0.28-linux-glibc2.17-x86_64.tar.gz"
default:
- return nil, fmt.Errorf("unsupported combination of OS[%s] and ARCH[%s]", runtime.GOOS, runtime.GOARCH)
+ return nil, fmt.Errorf("unsupported combination of OS %q and ARCH %q", runtime.GOOS, runtime.GOARCH)
}
version := strings.TrimRight(tarName, "tar.gz")
diff --git a/server/database.go b/server/database.go
index 5258cc0f51..8869f7d96f 100644
--- a/server/database.go
+++ b/server/database.go
@@ -38,7 +38,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
databaseCreate.EnvironmentID = instance.EnvironmentID
project, err := s.store.GetProjectByID(ctx, databaseCreate.ProjectID)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find project with ID[%d]", databaseCreate.ProjectID)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find project with ID %d", databaseCreate.ProjectID)).SetInternal(err)
}
if project == nil {
err := fmt.Errorf("project ID not found %v", databaseCreate.ProjectID)
@@ -146,15 +146,15 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
database, err := s.store.GetDatabase(ctx, &api.DatabaseFind{ID: &id})
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch database with ID[%d]", id)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch database with ID %d", id)).SetInternal(err)
}
if database == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID %d", id))
}
// Wildcard(*) database is used to connect all database at instance level.
// Do not return it via `get database by id` API.
if database.Name == api.AllDatabaseName {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Database with ID[%d] is a wildcard *", id))
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Database with ID %d is a wildcard *", id))
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
@@ -182,10 +182,10 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
database, err := s.store.GetDatabase(ctx, &api.DatabaseFind{ID: &id})
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch database with ID[%d]", id)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch database with ID %d", id)).SetInternal(err)
}
if database == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID %d", id))
}
targetProject := database.Project
@@ -201,7 +201,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
toProject, err := s.store.GetProjectByID(ctx, *dbPatch.ProjectID)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find project with ID[%d]", *dbPatch.ProjectID)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find project with ID %d", *dbPatch.ProjectID)).SetInternal(err)
}
if toProject == nil {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project ID not found: %d", *dbPatch.ProjectID))
@@ -262,10 +262,10 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
if dbPatch.ProjectID != nil {
dbExisting, err = s.store.GetDatabase(ctx, &api.DatabaseFind{ID: &dbPatch.ID})
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch database with ID[%d]", id)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch database with ID %d", id)).SetInternal(err)
}
if dbExisting == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID %d", id))
}
}
diff --git a/server/issue.go b/server/issue.go
index e04e2ae65a..28f6ce5252 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -432,7 +432,7 @@ func (s *Server) getPipelineCreate(ctx context.Context, issueCreate *api.IssueCr
// Find project
project, err := s.store.GetProjectByID(ctx, issueCreate.ProjectID)
if err != nil {
- return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID[%d]", issueCreate.ProjectID)).SetInternal(err)
+ return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID %d", issueCreate.ProjectID)).SetInternal(err)
}
if project == nil {
err := fmt.Errorf("project ID not found %v", issueCreate.ProjectID)
@@ -541,7 +541,7 @@ func (s *Server) getPipelineCreate(ctx context.Context, issueCreate *api.IssueCr
return nil, fmt.Errorf("failed to find backup %v", c.BackupID)
}
if backup == nil {
- return nil, fmt.Errorf("backup not found with ID[%d]", c.BackupID)
+ return nil, fmt.Errorf("backup not found with ID %d", c.BackupID)
}
restorePayload := api.TaskDatabaseRestorePayload{}
restorePayload.DatabaseName = c.DatabaseName
@@ -668,7 +668,7 @@ func (s *Server) getPipelineCreate(ctx context.Context, issueCreate *api.IssueCr
}
project, err := s.store.GetProjectByID(ctx, issueCreate.ProjectID)
if err != nil {
- return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID[%d]", issueCreate.ProjectID)).SetInternal(err)
+ return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID %d", issueCreate.ProjectID)).SetInternal(err)
}
schemaVersion := common.DefaultMigrationVersion()
@@ -813,7 +813,7 @@ func (s *Server) getPipelineCreate(ctx context.Context, issueCreate *api.IssueCr
project, err := s.store.GetProjectByID(ctx, issueCreate.ProjectID)
if err != nil {
- return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to fetch project with ID[%d]", issueCreate.ProjectID)).SetInternal(err)
+ return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to fetch project with ID %d", issueCreate.ProjectID)).SetInternal(err)
}
if project.TenantMode == api.TenantModeTenant {
return nil, echo.NewHTTPError(http.StatusBadRequest, "not implemented yet")
@@ -911,7 +911,7 @@ func createPITRTaskList(database *api.Database, projectID int, taskStatus api.Ta
}
bytesRestore, err := json.Marshal(payloadRestore)
if err != nil {
- return nil, nil, fmt.Errorf("failed to create PITR restore task, unable to marshal payload, error[%w]", err)
+ return nil, nil, fmt.Errorf("failed to create PITR restore task, unable to marshal payload, error: %w", err)
}
taskCreateList = append(taskCreateList, api.TaskCreate{
@@ -927,7 +927,7 @@ func createPITRTaskList(database *api.Database, projectID int, taskStatus api.Ta
payloadCutover := api.TaskDatabasePITRCutoverPayload{}
bytesCutover, err := json.Marshal(payloadCutover)
if err != nil {
- return nil, nil, fmt.Errorf("failed to create PITR cutover task, unable to marshal payload, error[%w]", err)
+ return nil, nil, fmt.Errorf("failed to create PITR cutover task, unable to marshal payload, error: %w", err)
}
taskCreateList = append(taskCreateList, api.TaskCreate{
@@ -1085,7 +1085,7 @@ func (s *Server) changeIssueStatus(ctx context.Context, issue *api.Issue, newSta
Status: &pipelineStatus,
}
if _, err := s.store.PatchPipeline(ctx, pipelinePatch); err != nil {
- return nil, fmt.Errorf("failed to update issue[%s] status, failed to update pipeline status with patch %+v, error: %w", issue.Name, pipelinePatch, err)
+ return nil, fmt.Errorf("failed to update issue %q's status, failed to update pipeline status with patch %+v, error: %w", issue.Name, pipelinePatch, err)
}
issuePatch := &api.IssuePatch{
@@ -1095,7 +1095,7 @@ func (s *Server) changeIssueStatus(ctx context.Context, issue *api.Issue, newSta
}
updatedIssue, err := s.store.PatchIssue(ctx, issuePatch)
if err != nil {
- return nil, fmt.Errorf("failed to update issue[%s] status with patch %v, error: %w", issue.Name, issuePatch, err)
+ return nil, fmt.Errorf("failed to update issue %q's status with patch %v, error: %w", issue.Name, issuePatch, err)
}
payload, err := json.Marshal(api.ActivityIssueStatusUpdatePayload{
diff --git a/server/project.go b/server/project.go
index 90a5c7b01d..e1510ef108 100644
--- a/server/project.go
+++ b/server/project.go
@@ -132,7 +132,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", id)).SetInternal(err)
}
if project == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", id))
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
@@ -171,7 +171,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
project, err := s.store.PatchProject(ctx, projectPatch)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", id))
}
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch project ID: %v", id)).SetInternal(err)
}
@@ -203,7 +203,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", projectID)).SetInternal(err)
}
if project == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", projectID))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", projectID))
}
if err := api.ValidateRepositoryFilePathTemplate(repositoryCreate.FilePathTemplate, project.TenantMode); err != nil {
@@ -324,7 +324,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", projectID)).SetInternal(err)
}
if project == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", projectID))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", projectID))
}
if repoPatch.FilePathTemplate != nil {
@@ -504,7 +504,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", id)).SetInternal(err)
}
if project == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", id))
}
deploymentConfigUpsert.ProjectID = id
@@ -532,7 +532,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", id)).SetInternal(err)
}
if project == nil {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID[%d]", id))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project not found with ID %d", id))
}
deploymentConfig, err := s.store.GetDeploymentConfigByProjectID(ctx, id)
diff --git a/server/task.go b/server/task.go
index 05a5562ae7..36569a7671 100644
--- a/server/task.go
+++ b/server/task.go
@@ -76,7 +76,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
// Tenant mode project don't allow updating SQL statement.
project, err := s.store.GetProjectByID(ctx, issue.ProjectID)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID[%d]", issue.ProjectID)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project with ID %d", issue.ProjectID)).SetInternal(err)
}
if project.TenantMode == api.TenantModeTenant && task.Type == api.TaskDatabaseSchemaUpdate {
err := fmt.Errorf("cannot update schema update SQL statement for projects in tenant mode")
diff --git a/server/task_executor.go b/server/task_executor.go
index 0ac049131f..2ebd3e21ac 100644
--- a/server/task_executor.go
+++ b/server/task_executor.go
@@ -87,7 +87,7 @@ func preMigration(ctx context.Context, server *Server, task *api.Task, migration
)
// This should not happen normally as we already check this when creating the issue. Just in case.
if err != nil {
- return nil, fmt.Errorf("failed to prepare for database migration, error[%w]", err)
+ return nil, fmt.Errorf("failed to prepare for database migration, error: %w", err)
}
mi.Creator = vcsPushEvent.FileCommit.AuthorName
@@ -96,7 +96,7 @@ func preMigration(ctx context.Context, server *Server, task *api.Task, migration
}
bytes, err := json.Marshal(miPayload)
if err != nil {
- return nil, fmt.Errorf("failed to prepare for database migration, unable to marshal vcs push event payload, error[%w]", err)
+ return nil, fmt.Errorf("failed to prepare for database migration, unable to marshal vcs push event payload, error: %w", err)
}
mi.Payload = string(bytes)
}
diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.go
index 1ab909ed74..1b8a2df408 100644
--- a/server/task_executor_database_backup.go
+++ b/server/task_executor_database_backup.go
@@ -30,7 +30,7 @@ func (exec *DatabaseBackupTaskExecutor) RunOnce(ctx context.Context, server *Ser
backup, err := server.store.GetBackupByID(ctx, payload.BackupID)
if err != nil {
- return true, nil, fmt.Errorf("failed to find backup with ID[%d], error[%w]", payload.BackupID, err)
+ return true, nil, fmt.Errorf("failed to find backup with ID %d, error: %w", payload.BackupID, err)
}
if backup == nil {
return true, nil, fmt.Errorf("backup %v not found", payload.BackupID)
diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.go
index 29050be82a..6fd57d84ab 100644
--- a/server/task_executor_database_create.go
+++ b/server/task_executor_database_create.go
@@ -153,10 +153,10 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser
if payload.Labels != "" {
project, err := server.store.GetProjectByID(ctx, payload.ProjectID)
if err != nil {
- return true, nil, fmt.Errorf("failed to find project with ID[%d]", payload.ProjectID)
+ return true, nil, fmt.Errorf("failed to find project with ID %d", payload.ProjectID)
}
if project == nil {
- return true, nil, fmt.Errorf("project not found with ID[%d]", payload.ProjectID)
+ return true, nil, fmt.Errorf("project not found with ID %d", payload.ProjectID)
}
// Set database labels, except bb.environment is immutable and must match instance environment.
diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.go
index ed41fa9d9e..f681613d24 100644
--- a/server/task_executor_database_restore.go
+++ b/server/task_executor_database_restore.go
@@ -35,10 +35,10 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
backup, err := server.store.GetBackupByID(ctx, payload.BackupID)
if err != nil {
- return true, nil, fmt.Errorf("failed to find backup with ID[%d], error[%w]", payload.BackupID, err)
+ return true, nil, fmt.Errorf("failed to find backup with ID %d, error: %w", payload.BackupID, err)
}
if backup == nil {
- return true, nil, fmt.Errorf("backup with ID[%d] not found", payload.BackupID)
+ return true, nil, fmt.Errorf("backup with ID %d not found", payload.BackupID)
}
sourceDatabase, err := server.store.GetDatabase(ctx, &api.DatabaseFind{ID: &backup.DatabaseID})
@@ -91,7 +91,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
SourceBackupID: &backup.ID,
}
if _, err = server.store.PatchDatabase(ctx, databasePatch); err != nil {
- return true, nil, fmt.Errorf("failed to patch database source with ID[%d] and backup ID[%d] after restore, error[%w]", targetDatabase.ID, backup.ID, err)
+ return true, nil, fmt.Errorf("failed to patch database source with ID %d and backup ID %d after restore, error: %w", targetDatabase.ID, backup.ID, err)
}
// Sync database schema after restore is completed.
diff --git a/server/task_executor_pitr_cutover.go b/server/task_executor_pitr_cutover.go
index 69d7bacb5b..bb55fa0358 100644
--- a/server/task_executor_pitr_cutover.go
+++ b/server/task_executor_pitr_cutover.go
@@ -76,7 +76,7 @@ func (exec *PITRCutoverTaskExecutor) pitrCutover(ctx context.Context, task *api.
zap.Int("issueID", issue.ID),
zap.String("database", task.Database.Name),
zap.Error(err))
- return true, nil, fmt.Errorf("failed to swap the original and PITR database, error[%w]", err)
+ return true, nil, fmt.Errorf("failed to swap the original and PITR database, error: %w", err)
}
log.Info("Finish swapping the original and PITR database",
@@ -100,7 +100,7 @@ func (exec *PITRCutoverTaskExecutor) pitrCutover(ctx context.Context, task *api.
if _, _, err := driver.ExecuteMigration(ctx, m, "/* pitr cutover */"); err != nil {
log.Error("Failed to add migration history record", zap.Error(err))
- return true, nil, fmt.Errorf("failed to add migration history record, error[%w]", err)
+ return true, nil, fmt.Errorf("failed to add migration history record, error: %w", err)
}
// Sync database schema after restore is completed.
diff --git a/server/vcs.go b/server/vcs.go
index f941dec40b..905a3a5ab2 100644
--- a/server/vcs.go
+++ b/server/vcs.go
@@ -115,7 +115,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
DeleterID: c.Get(getPrincipalIDContextKey()).(int),
}
if err := s.store.DeleteVCS(ctx, vcsDelete); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete VCS with ID[%d]", id)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete VCS with ID %d", id)).SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
diff --git a/server/webhook.go b/server/webhook.go
index 8292850906..182743ff1e 100644
--- a/server/webhook.go
+++ b/server/webhook.go
@@ -253,7 +253,7 @@ func (s *Server) createSchemaUpdateIssue(ctx context.Context, repository *api.Re
if err != nil {
return "", fmt.Errorf("failed to find database matching database %q referenced by the committed file", mi.Database)
} else if len(databaseList) == 0 {
- return "", fmt.Errorf("project with ID[%d] does not own database %q referenced by the committed file", repository.ProjectID, mi.Database)
+ return "", fmt.Errorf("project with ID %d does not own database %q referenced by the committed file", repository.ProjectID, mi.Database)
}
// We support 3 patterns on how to organize the schema files.
diff --git a/store/activity.go b/store/activity.go
index d047fd34ca..3cb45011b7 100644
--- a/store/activity.go
+++ b/store/activity.go
@@ -57,11 +57,11 @@ func (raw *activityRaw) toActivity() *api.Activity {
func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate) (*api.Activity, error) {
activityRaw, err := s.createActivityRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Activity with ActivityCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Activity with ActivityCreate[%+v], error: %w", create, err)
}
activity, err := s.composeActivity(ctx, activityRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)
+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error: %w", activityRaw, err)
}
return activity, nil
}
@@ -70,14 +70,14 @@ func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate)
func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, error) {
activityRaw, err := s.getActivityRawByID(ctx, id)
if err != nil {
- return nil, fmt.Errorf("failed to get Activity with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Activity with ID %d, error: %w", id, err)
}
if activityRaw == nil {
return nil, nil
}
activity, err := s.composeActivity(ctx, activityRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)
+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error: %w", activityRaw, err)
}
return activity, nil
}
@@ -86,13 +86,13 @@ func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, err
func (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*api.Activity, error) {
activityRawList, err := s.findActivityRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Activity list with ActivityFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Activity list with ActivityFind[%+v], error: %w", find, err)
}
var activityList []*api.Activity
for _, raw := range activityRawList {
activity, err := s.composeActivity(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error: %w", raw, err)
}
activityList = append(activityList, activity)
}
@@ -103,11 +103,11 @@ func (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*ap
func (s *Store) PatchActivity(ctx context.Context, patch *api.ActivityPatch) (*api.Activity, error) {
activityRaw, err := s.patchActivityRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Activity with ActivityPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Activity with ActivityPatch[%+v], error: %w", patch, err)
}
activity, err := s.composeActivity(ctx, activityRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)
+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error: %w", activityRaw, err)
}
return activity, nil
}
diff --git a/store/anomaly.go b/store/anomaly.go
index 5a4ececc2f..cd8f2fbe69 100644
--- a/store/anomaly.go
+++ b/store/anomaly.go
@@ -60,11 +60,11 @@ func (raw *anomalyRaw) toAnomaly() *api.Anomaly {
func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsert) (*api.Anomaly, error) {
anomalyRaw, err := s.upsertActiveAnomalyRaw(ctx, upsert)
if err != nil {
- return nil, fmt.Errorf("failed to upsert active anomaly with AnomalyUpsert[%+v], error[%w]", upsert, err)
+ return nil, fmt.Errorf("failed to upsert active anomaly with AnomalyUpsert[%+v], error: %w", upsert, err)
}
anomaly, err := s.composeAnomaly(ctx, anomalyRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)
+ return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error: %w", anomalyRaw, err)
}
return anomaly, nil
}
@@ -73,13 +73,13 @@ func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpse
func (s *Store) FindAnomaly(ctx context.Context, find *api.AnomalyFind) ([]*api.Anomaly, error) {
anomalyRawList, err := s.findAnomalyRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find anomaly with AnomalyFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find anomaly with AnomalyFind[%+v], error: %w", find, err)
}
var anomalyList []*api.Anomaly
for _, anomalyRaw := range anomalyRawList {
anomaly, err := s.composeAnomaly(ctx, anomalyRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)
+ return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error: %w", anomalyRaw, err)
}
anomalyList = append(anomalyList, anomaly)
}
diff --git a/store/backup.go b/store/backup.go
index c5be6c76cc..0daa823b83 100644
--- a/store/backup.go
+++ b/store/backup.go
@@ -115,11 +115,11 @@ func (raw *backupSettingRaw) toBackupSetting() *api.BackupSetting {
func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*api.Backup, error) {
backupRaw, err := s.createBackupRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Backup with BackupCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Backup with BackupCreate[%+v], error: %w", create, err)
}
backup, err := s.composeBackup(ctx, backupRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", backupRaw, err)
}
return backup, nil
}
@@ -128,14 +128,14 @@ func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*ap
func (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error) {
backupRaw, err := s.getBackupRawByID(ctx, id)
if err != nil {
- return nil, fmt.Errorf("failed to get backup setting by ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get backup setting by ID %d, error: %w", id, err)
}
if backupRaw == nil {
return nil, nil
}
backupSetting, err := s.composeBackup(ctx, backupRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", backupRaw, err)
}
return backupSetting, nil
}
@@ -144,13 +144,13 @@ func (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error)
func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Backup, error) {
backupRawList, err := s.findBackupRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Backup list with BackupFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Backup list with BackupFind[%+v], error: %w", find, err)
}
var backupList []*api.Backup
for _, raw := range backupRawList {
backup, err := s.composeBackup(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", raw, err)
}
backupList = append(backupList, backup)
}
@@ -161,11 +161,11 @@ func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Ba
func (s *Store) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.Backup, error) {
backupRaw, err := s.patchBackupRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Backup with BackupPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Backup with BackupPatch[%+v], error: %w", patch, err)
}
backup, err := s.composeBackup(ctx, backupRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", backupRaw, err)
}
return backup, nil
}
@@ -174,14 +174,14 @@ func (s *Store) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.B
func (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.BackupSetting, error) {
backupSettingRaw, err := s.getBackupSettingRaw(ctx, &api.BackupSettingFind{DatabaseID: &id})
if err != nil {
- return nil, fmt.Errorf("failed to get backup setting by ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get backup setting by ID %d, error: %w", id, err)
}
if backupSettingRaw == nil {
return nil, nil
}
backupSetting, err := s.composeBackupSetting(ctx, backupSettingRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose BackupSetting with backupSettingRaw[%+v], error[%w]", backupSettingRaw, err)
+ return nil, fmt.Errorf("failed to compose BackupSetting with backupSettingRaw[%+v], error: %w", backupSettingRaw, err)
}
return backupSetting, nil
}
@@ -190,11 +190,11 @@ func (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.
func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error) {
backupSettingRaw, err := s.upsertBackupSettingRaw(ctx, upsert)
if err != nil {
- return nil, fmt.Errorf("failed to upsert backup setting with BackupSettingUpsert[%+v], error[%w]", upsert, err)
+ return nil, fmt.Errorf("failed to upsert backup setting with BackupSettingUpsert[%+v], error: %w", upsert, err)
}
backup, err := s.composeBackupSetting(ctx, backupSettingRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupSettingRaw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", backupSettingRaw, err)
}
return backup, nil
}
@@ -203,13 +203,13 @@ func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSetti
func (s *Store) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSettingsMatch) ([]*api.BackupSetting, error) {
backupSettingRawList, err := s.findBackupSettingsMatchImpl(ctx, match)
if err != nil {
- return nil, fmt.Errorf("failed to find matching backup setting list with BackupSettingsMatch[%+v], error[%w]", match, err)
+ return nil, fmt.Errorf("failed to find matching backup setting list with BackupSettingsMatch[%+v], error: %w", match, err)
}
var backupSettingList []*api.BackupSetting
for _, raw := range backupSettingRawList {
backupSetting, err := s.composeBackupSetting(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error: %w", raw, err)
}
backupSettingList = append(backupSettingList, backupSetting)
}
diff --git a/store/bookmark.go b/store/bookmark.go
index 490a037160..54c87e8769 100644
--- a/store/bookmark.go
+++ b/store/bookmark.go
@@ -48,11 +48,11 @@ func (raw *bookmarkRaw) toBookmark() *api.Bookmark {
func (s *Store) CreateBookmark(ctx context.Context, create *api.BookmarkCreate) (*api.Bookmark, error) {
bookmarkRaw, err := s.createBookmarkRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Bookmark with BookmarkCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Bookmark with BookmarkCreate[%+v], error: %w", create, err)
}
bookmark, err := s.composeBookmark(ctx, bookmarkRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)
+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error: %w", bookmarkRaw, err)
}
return bookmark, nil
}
@@ -62,14 +62,14 @@ func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, err
find := &api.BookmarkFind{ID: &id}
bookmarkRaw, err := s.getBookmarkRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Bookmark with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Bookmark with ID %d, error: %w", id, err)
}
if bookmarkRaw == nil {
return nil, nil
}
bookmark, err := s.composeBookmark(ctx, bookmarkRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)
+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error: %w", bookmarkRaw, err)
}
return bookmark, nil
}
@@ -78,13 +78,13 @@ func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, err
func (s *Store) FindBookmark(ctx context.Context, find *api.BookmarkFind) ([]*api.Bookmark, error) {
bookmarkRawList, err := s.findBookmarkRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Bookmark list with BookmarkFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Bookmark list with BookmarkFind[%+v], error: %w", find, err)
}
var bookmarkList []*api.Bookmark
for _, raw := range bookmarkRawList {
bookmark, err := s.composeBookmark(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error: %w", raw, err)
}
bookmarkList = append(bookmarkList, bookmark)
}
diff --git a/store/data_source.go b/store/data_source.go
index 66e31fc890..caa21bcb8c 100644
--- a/store/data_source.go
+++ b/store/data_source.go
@@ -66,11 +66,11 @@ func (raw *dataSourceRaw) toDataSource() *api.DataSource {
func (s *Store) CreateDataSource(ctx context.Context, create *api.DataSourceCreate) (*api.DataSource, error) {
dataSourceRaw, err := s.createDataSourceRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error: %w", create, err)
}
dataSource, err := s.composeDataSource(ctx, dataSourceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)
+ return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error: %w", dataSourceRaw, err)
}
return dataSource, nil
}
@@ -79,14 +79,14 @@ func (s *Store) CreateDataSource(ctx context.Context, create *api.DataSourceCrea
func (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*api.DataSource, error) {
dataSourceRaw, err := s.getDataSourceRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get data source with DataSourceFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get data source with DataSourceFind[%+v], error: %w", find, err)
}
if dataSourceRaw == nil {
return nil, nil
}
dataSource, err := s.composeDataSource(ctx, dataSourceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)
+ return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error: %w", dataSourceRaw, err)
}
return dataSource, nil
}
@@ -95,13 +95,13 @@ func (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*a
func (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([]*api.DataSource, error) {
DataSourceRawList, err := s.findDataSourceRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find DataSource list with DataSourceFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find DataSource list with DataSourceFind[%+v], error: %w", find, err)
}
var DataSourceList []*api.DataSource
for _, raw := range DataSourceRawList {
DataSource, err := s.composeDataSource(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error: %w", raw, err)
}
DataSourceList = append(DataSourceList, DataSource)
}
@@ -112,11 +112,11 @@ func (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([
func (s *Store) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch) (*api.DataSource, error) {
dataSourceRaw, err := s.patchDataSourceRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch DataSource with DataSourcePatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch DataSource with DataSourcePatch[%+v], error: %w", patch, err)
}
DataSource, err := s.composeDataSource(ctx, dataSourceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)
+ return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error: %w", dataSourceRaw, err)
}
return DataSource, nil
}
@@ -130,7 +130,7 @@ func (s *Store) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch)
func (s *Store) createDataSourceRawTx(ctx context.Context, tx *sql.Tx, create *api.DataSourceCreate) error {
_, err := s.createDataSourceImpl(ctx, tx, create)
if err != nil {
- return fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)
+ return fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error: %w", create, err)
}
return nil
}
diff --git a/store/database.go b/store/database.go
index f744480a3d..453d67f40c 100644
--- a/store/database.go
+++ b/store/database.go
@@ -69,11 +69,11 @@ func (raw *databaseRaw) toDatabase() *api.Database {
func (s *Store) CreateDatabase(ctx context.Context, create *api.DatabaseCreate) (*api.Database, error) {
databaseRaw, err := s.createDatabaseRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Database with DatabaseCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Database with DatabaseCreate[%+v], error: %w", create, err)
}
database, err := s.composeDatabase(ctx, databaseRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error[%w]", databaseRaw, err)
+ return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error: %w", databaseRaw, err)
}
return database, nil
}
@@ -82,13 +82,13 @@ func (s *Store) CreateDatabase(ctx context.Context, create *api.DatabaseCreate)
func (s *Store) FindDatabase(ctx context.Context, find *api.DatabaseFind) ([]*api.Database, error) {
databaseRawList, err := s.findDatabaseRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Database list with DatabaseFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Database list with DatabaseFind[%+v], error: %w", find, err)
}
var databaseList []*api.Database
for _, raw := range databaseRawList {
database, err := s.composeDatabase(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error: %w", raw, err)
}
databaseList = append(databaseList, database)
}
@@ -112,14 +112,14 @@ func (s *Store) FindDatabase(ctx context.Context, find *api.DatabaseFind) ([]*ap
func (s *Store) GetDatabase(ctx context.Context, find *api.DatabaseFind) (*api.Database, error) {
databaseRaw, err := s.getDatabaseRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Database with DatabaseFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get Database with DatabaseFind[%+v], error: %w", find, err)
}
if databaseRaw == nil {
return nil, nil
}
database, err := s.composeDatabase(ctx, databaseRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error[%w]", databaseRaw, err)
+ return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error: %w", databaseRaw, err)
}
return database, nil
}
@@ -128,11 +128,11 @@ func (s *Store) GetDatabase(ctx context.Context, find *api.DatabaseFind) (*api.D
func (s *Store) PatchDatabase(ctx context.Context, patch *api.DatabasePatch) (*api.Database, error) {
databaseRaw, err := s.patchDatabaseRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Database with DatabasePatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Database with DatabasePatch[%+v], error: %w", patch, err)
}
database, err := s.composeDatabase(ctx, databaseRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error[%w]", databaseRaw, err)
+ return nil, fmt.Errorf("failed to compose Database with databaseRaw[%+v], error: %w", databaseRaw, err)
}
return database, nil
}
diff --git a/store/deploy.go b/store/deploy.go
index 88afab1bd1..095e4d4d04 100644
--- a/store/deploy.go
+++ b/store/deploy.go
@@ -54,14 +54,14 @@ func (raw *deploymentConfigRaw) toDeploymentConfig() *api.DeploymentConfig {
func (s *Store) GetDeploymentConfigByProjectID(ctx context.Context, projectID int) (*api.DeploymentConfig, error) {
deploymentConfigRaw, err := s.getDeploymentConfigImpl(ctx, &api.DeploymentConfigFind{ProjectID: &projectID})
if err != nil {
- return nil, fmt.Errorf("failed to get DeploymentConfig with projectID[%d], error[%w]", projectID, err)
+ return nil, fmt.Errorf("failed to get DeploymentConfig with projectID %d, error: %w", projectID, err)
}
if deploymentConfigRaw == nil {
return nil, nil
}
deploymentConfig, err := s.composeDeploymentConfig(ctx, deploymentConfigRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DeploymentConfig with deploymentConfigRaw[%+v], error[%w]", deploymentConfigRaw, err)
+ return nil, fmt.Errorf("failed to compose DeploymentConfig with deploymentConfigRaw[%+v], error: %w", deploymentConfigRaw, err)
}
return deploymentConfig, nil
}
@@ -70,11 +70,11 @@ func (s *Store) GetDeploymentConfigByProjectID(ctx context.Context, projectID in
func (s *Store) UpsertDeploymentConfig(ctx context.Context, upsert *api.DeploymentConfigUpsert) (*api.DeploymentConfig, error) {
deploymentConfigRaw, err := s.upsertDeploymentConfigRaw(ctx, upsert)
if err != nil {
- return nil, fmt.Errorf("failed to upsert deployment config with DeploymentConfigUpsert[%+v], error[%w]", upsert, err)
+ return nil, fmt.Errorf("failed to upsert deployment config with DeploymentConfigUpsert[%+v], error: %w", upsert, err)
}
deploymentConfig, err := s.composeDeploymentConfig(ctx, deploymentConfigRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DeploymentConfig with deploymentConfigRaw[%+v], error[%w]", deploymentConfigRaw, err)
+ return nil, fmt.Errorf("failed to compose DeploymentConfig with deploymentConfigRaw[%+v], error: %w", deploymentConfigRaw, err)
}
return deploymentConfig, nil
}
diff --git a/store/environment.go b/store/environment.go
index 21779f984d..737730b601 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -48,11 +48,11 @@ func (raw *environmentRaw) toEnvironment() *api.Environment {
func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCreate) (*api.Environment, error) {
environmentRaw, err := s.createEnvironmentRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Environment with EnvironmentCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Environment with EnvironmentCreate[%+v], error: %w", create, err)
}
Environment, err := s.composeEnvironment(ctx, environmentRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Environment with environmentRaw[%+v], error[%w]", environmentRaw, err)
+ return nil, fmt.Errorf("failed to compose Environment with environmentRaw[%+v], error: %w", environmentRaw, err)
}
return Environment, nil
}
@@ -61,13 +61,13 @@ func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCr
func (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind) ([]*api.Environment, error) {
EnvironmentRawList, err := s.findEnvironmentRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Environment list with EnvironmentFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Environment list with EnvironmentFind[%+v], error: %w", find, err)
}
var EnvironmentList []*api.Environment
for _, raw := range EnvironmentRawList {
Environment, err := s.composeEnvironment(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error: %w", raw, err)
}
EnvironmentList = append(EnvironmentList, Environment)
}
@@ -78,11 +78,11 @@ func (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind)
func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatch) (*api.Environment, error) {
environmentRaw, err := s.patchEnvironmentRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Environment with EnvironmentPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Environment with EnvironmentPatch[%+v], error: %w", patch, err)
}
Environment, err := s.composeEnvironment(ctx, environmentRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error[%w]", environmentRaw, err)
+ return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error: %w", environmentRaw, err)
}
return Environment, nil
}
@@ -91,7 +91,7 @@ func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatc
func (s *Store) GetEnvironmentByID(ctx context.Context, id int) (*api.Environment, error) {
envRaw, err := s.getEnvironmentByIDRaw(ctx, id)
if err != nil {
- return nil, fmt.Errorf("failed to get environment with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get environment with ID %d, error: %w", id, err)
}
if envRaw == nil {
return nil, nil
@@ -99,7 +99,7 @@ func (s *Store) GetEnvironmentByID(ctx context.Context, id int) (*api.Environmen
env, err := s.composeEnvironment(ctx, envRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose environment with environmentRaw[%+v], error[%w]", envRaw, err)
+ return nil, fmt.Errorf("failed to compose environment with environmentRaw[%+v], error: %w", envRaw, err)
}
return env, nil
diff --git a/store/extension.go b/store/extension.go
index 71a3cd7653..b9e16f1cd0 100644
--- a/store/extension.go
+++ b/store/extension.go
@@ -57,11 +57,11 @@ func (raw *dbExtensionRaw) toDBExtension() *api.DBExtension {
func (s *Store) CreateDBExtension(ctx context.Context, create *api.DBExtensionCreate) (*api.DBExtension, error) {
dbExtensionRaw, err := s.createDBExtensionRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create dbExtension with dbExtensionCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create dbExtension with dbExtensionCreate[%+v], error: %w", create, err)
}
dbExtension, err := s.composeDBExtension(ctx, dbExtensionRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose dbExtension with dbExtensionRaw[%+v], error[%w]", dbExtensionRaw, err)
+ return nil, fmt.Errorf("failed to compose dbExtension with dbExtensionRaw[%+v], error: %w", dbExtensionRaw, err)
}
return dbExtension, nil
}
@@ -70,13 +70,13 @@ func (s *Store) CreateDBExtension(ctx context.Context, create *api.DBExtensionCr
func (s *Store) FindDBExtension(ctx context.Context, find *api.DBExtensionFind) ([]*api.DBExtension, error) {
dbExtensionRawList, err := s.findDBExtensionRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find dbExtension list with dbExtensionFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find dbExtension list with dbExtensionFind[%+v], error: %w", find, err)
}
var dbExtensionList []*api.DBExtension
for _, raw := range dbExtensionRawList {
dbExtension, err := s.composeDBExtension(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose dbExtension with dbExtensionRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose dbExtension with dbExtensionRaw[%+v], error: %w", raw, err)
}
dbExtensionList = append(dbExtensionList, dbExtension)
}
diff --git a/store/inbox.go b/store/inbox.go
index d8ab3bc9e1..5254fbae70 100644
--- a/store/inbox.go
+++ b/store/inbox.go
@@ -36,11 +36,11 @@ func (raw *inboxRaw) toInbox() *api.Inbox {
func (s *Store) CreateInbox(ctx context.Context, create *api.InboxCreate) (*api.Inbox, error) {
inboxRaw, err := s.createInboxRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Inbox with InboxCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Inbox with InboxCreate[%+v], error: %w", create, err)
}
inbox, err := s.composeInbox(ctx, inboxRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)
+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error: %w", inboxRaw, err)
}
return inbox, nil
}
@@ -50,14 +50,14 @@ func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {
find := &api.InboxFind{ID: &id}
inboxRaw, err := s.getInboxRawByID(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Inbox with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Inbox with ID %d, error: %w", id, err)
}
if inboxRaw == nil {
return nil, nil
}
inbox, err := s.composeInbox(ctx, inboxRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)
+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error: %w", inboxRaw, err)
}
return inbox, nil
}
@@ -66,13 +66,13 @@ func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {
func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inbox, error) {
inboxRawList, err := s.findInboxRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Inbox list with InboxFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Inbox list with InboxFind[%+v], error: %w", find, err)
}
var inboxList []*api.Inbox
for _, raw := range inboxRawList {
inbox, err := s.composeInbox(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error: %w", raw, err)
}
inboxList = append(inboxList, inbox)
}
@@ -83,11 +83,11 @@ func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inbo
func (s *Store) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inbox, error) {
inboxRaw, err := s.patchInboxRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Inbox with InboxPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Inbox with InboxPatch[%+v], error: %w", patch, err)
}
inbox, err := s.composeInbox(ctx, inboxRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)
+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error: %w", inboxRaw, err)
}
return inbox, nil
}
diff --git a/store/instance.go b/store/instance.go
index 2695c26649..481f898dd7 100644
--- a/store/instance.go
+++ b/store/instance.go
@@ -66,11 +66,11 @@ func (raw *instanceRaw) toInstance() *api.Instance {
func (s *Store) CreateInstance(ctx context.Context, create *api.InstanceCreate) (*api.Instance, error) {
instanceRaw, err := s.createInstanceRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Instance with InstanceCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Instance with InstanceCreate[%+v], error: %w", create, err)
}
instance, err := s.composeInstance(ctx, instanceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)
+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error: %w", instanceRaw, err)
}
return instance, nil
}
@@ -80,14 +80,14 @@ func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, err
find := &api.InstanceFind{ID: &id}
instanceRaw, err := s.getInstanceRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Instance with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Instance with ID %d, error: %w", id, err)
}
if instanceRaw == nil {
return nil, nil
}
instance, err := s.composeInstance(ctx, instanceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)
+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error: %w", instanceRaw, err)
}
return instance, nil
}
@@ -96,13 +96,13 @@ func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, err
func (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*api.Instance, error) {
instanceRawList, err := s.findInstanceRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Instance list with InstanceFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Instance list with InstanceFind[%+v], error: %w", find, err)
}
var instanceList []*api.Instance
for _, raw := range instanceRawList {
instance, err := s.composeInstance(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error: %w", raw, err)
}
instanceList = append(instanceList, instance)
}
@@ -113,11 +113,11 @@ func (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*ap
func (s *Store) PatchInstance(ctx context.Context, patch *api.InstancePatch) (*api.Instance, error) {
instanceRaw, err := s.patchInstanceRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Instance with InstancePatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Instance with InstancePatch[%+v], error: %w", patch, err)
}
instance, err := s.composeInstance(ctx, instanceRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)
+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error: %w", instanceRaw, err)
}
return instance, nil
}
diff --git a/store/issue.go b/store/issue.go
index 403b2523c9..a477f954d9 100644
--- a/store/issue.go
+++ b/store/issue.go
@@ -68,11 +68,11 @@ func (raw *issueRaw) toIssue() *api.Issue {
func (s *Store) CreateIssue(ctx context.Context, create *api.IssueCreate) (*api.Issue, error) {
issueRaw, err := s.createIssueRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Issue with IssueCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Issue with IssueCreate[%+v], error: %w", create, err)
}
issue, err := s.composeIssue(ctx, issueRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error[%w]", issueRaw, err)
+ return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error: %w", issueRaw, err)
}
return issue, nil
}
@@ -82,14 +82,14 @@ func (s *Store) GetIssueByID(ctx context.Context, id int) (*api.Issue, error) {
find := &api.IssueFind{ID: &id}
issueRaw, err := s.getIssueRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Issue with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Issue with ID %d, error: %w", id, err)
}
if issueRaw == nil {
return nil, nil
}
issue, err := s.composeIssue(ctx, issueRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error[%w]", issueRaw, err)
+ return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error: %w", issueRaw, err)
}
return issue, nil
}
@@ -99,14 +99,14 @@ func (s *Store) GetIssueByPipelineID(ctx context.Context, id int) (*api.Issue, e
find := &api.IssueFind{PipelineID: &id}
issueRaw, err := s.getIssueRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Issue with PipelineID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Issue with PipelineID %d, error: %w", id, err)
}
if issueRaw == nil {
return nil, nil
}
issue, err := s.composeIssue(ctx, issueRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error[%w]", issueRaw, err)
+ return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error: %w", issueRaw, err)
}
return issue, nil
}
@@ -115,13 +115,13 @@ func (s *Store) GetIssueByPipelineID(ctx context.Context, id int) (*api.Issue, e
func (s *Store) FindIssue(ctx context.Context, find *api.IssueFind) ([]*api.Issue, error) {
issueRawList, err := s.findIssueRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Issue list with IssueFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Issue list with IssueFind[%+v], error: %w", find, err)
}
var issueList []*api.Issue
for _, raw := range issueRawList {
issue, err := s.composeIssue(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error: %w", raw, err)
}
issueList = append(issueList, issue)
}
@@ -132,11 +132,11 @@ func (s *Store) FindIssue(ctx context.Context, find *api.IssueFind) ([]*api.Issu
func (s *Store) PatchIssue(ctx context.Context, patch *api.IssuePatch) (*api.Issue, error) {
issueRaw, err := s.patchIssueRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Issue with IssuePatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Issue with IssuePatch[%+v], error: %w", patch, err)
}
issue, err := s.composeIssue(ctx, issueRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error[%w]", issueRaw, err)
+ return nil, fmt.Errorf("failed to compose Issue with issueRaw[%+v], error: %w", issueRaw, err)
}
return issue, nil
}
diff --git a/store/issue_subscriber.go b/store/issue_subscriber.go
index d793859342..bb6a751d54 100644
--- a/store/issue_subscriber.go
+++ b/store/issue_subscriber.go
@@ -29,11 +29,11 @@ func (raw *issueSubscriberRaw) toIssueSubscriber() *api.IssueSubscriber {
func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubscriberCreate) (*api.IssueSubscriber, error) {
issueSubRaw, err := s.createIssueSubscriberRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create IssueSubscriber with IssueSubscriberCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create IssueSubscriber with IssueSubscriberCreate[%+v], error: %w", create, err)
}
issueSub, err := s.composeIssueSubscriber(ctx, issueSubRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", issueSubRaw, err)
+ return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error: %w", issueSubRaw, err)
}
return issueSub, nil
}
@@ -42,13 +42,13 @@ func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubs
func (s *Store) FindIssueSubscriber(ctx context.Context, find *api.IssueSubscriberFind) ([]*api.IssueSubscriber, error) {
issueSubRawList, err := s.findIssueSubscriberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find IssueSubscriber list with IssueSubscriberFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find IssueSubscriber list with IssueSubscriberFind[%+v], error: %w", find, err)
}
var issueSubList []*api.IssueSubscriber
for _, raw := range issueSubRawList {
issueSub, err := s.composeIssueSubscriber(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error: %w", raw, err)
}
issueSubList = append(issueSubList, issueSub)
}
diff --git a/store/label.go b/store/label.go
index ee964a80c4..966226bd2e 100644
--- a/store/label.go
+++ b/store/label.go
@@ -144,7 +144,7 @@ func (s *Store) SetDatabaseLabelList(ctx context.Context, labelList []*api.Datab
label, err := s.composeDatabaseLabel(ctx, labelRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DatabaseLabel with databaseLabelRaw[%+v], error[%w]", labelRaw, err)
+ return nil, fmt.Errorf("failed to compose DatabaseLabel with databaseLabelRaw[%+v], error: %w", labelRaw, err)
}
ret = append(ret, label)
}
@@ -161,13 +161,13 @@ func (s *Store) SetDatabaseLabelList(ctx context.Context, labelList []*api.Datab
func (s *Store) FindLabelKey(ctx context.Context, find *api.LabelKeyFind) ([]*api.LabelKey, error) {
labelKeyRawList, err := s.findLabelKeyRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find LabelKey list with LabelKeyFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find LabelKey list with LabelKeyFind[%+v], error: %w", find, err)
}
var labelKeyList []*api.LabelKey
for _, raw := range labelKeyRawList {
labelKey, err := s.composeLabelKey(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose LabelKey with labelKeyRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose LabelKey with labelKeyRaw[%+v], error: %w", raw, err)
}
labelKeyList = append(labelKeyList, labelKey)
}
@@ -178,11 +178,11 @@ func (s *Store) FindLabelKey(ctx context.Context, find *api.LabelKeyFind) ([]*ap
func (s *Store) PatchLabelKey(ctx context.Context, patch *api.LabelKeyPatch) (*api.LabelKey, error) {
labelKeyRaw, err := s.patchLabelKeyRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch LabelKey with LabelKeyPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch LabelKey with LabelKeyPatch[%+v], error: %w", patch, err)
}
labelKey, err := s.composeLabelKey(ctx, labelKeyRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose LabelKey with labelKeyRaw[%+v], error[%w]", labelKeyRaw, err)
+ return nil, fmt.Errorf("failed to compose LabelKey with labelKeyRaw[%+v], error: %w", labelKeyRaw, err)
}
return labelKey, nil
}
@@ -191,13 +191,13 @@ func (s *Store) PatchLabelKey(ctx context.Context, patch *api.LabelKeyPatch) (*a
func (s *Store) FindDatabaseLabel(ctx context.Context, find *api.DatabaseLabelFind) ([]*api.DatabaseLabel, error) {
labelKeyRawList, err := s.findDatabaseLabelRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find DatabaseLabel list with DatabaseLabelFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find DatabaseLabel list with DatabaseLabelFind[%+v], error: %w", find, err)
}
var labelKeyList []*api.DatabaseLabel
for _, raw := range labelKeyRawList {
labelKey, err := s.composeDatabaseLabel(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose DatabaseLabel with labelKeyRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose DatabaseLabel with labelKeyRaw[%+v], error: %w", raw, err)
}
labelKeyList = append(labelKeyList, labelKey)
}
diff --git a/store/member.go b/store/member.go
index 6128f06372..d5b371995a 100644
--- a/store/member.go
+++ b/store/member.go
@@ -53,11 +53,11 @@ func (raw *memberRaw) toMember() *api.Member {
func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*api.Member, error) {
memberRaw, err := s.createMemberRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Member with MemberCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Member with MemberCreate[%+v], error: %w", create, err)
}
member, err := s.composeMember(ctx, memberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)
+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error: %w", memberRaw, err)
}
return member, nil
}
@@ -66,13 +66,13 @@ func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*ap
func (s *Store) FindMember(ctx context.Context, find *api.MemberFind) ([]*api.Member, error) {
memberRawList, err := s.findMemberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Member list with MemberFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Member list with MemberFind[%+v], error: %w", find, err)
}
var memberList []*api.Member
for _, raw := range memberRawList {
member, err := s.composeMember(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error: %w", raw, err)
}
memberList = append(memberList, member)
}
@@ -84,14 +84,14 @@ func (s *Store) GetMemberByPrincipalID(ctx context.Context, id int) (*api.Member
find := &api.MemberFind{PrincipalID: &id}
memberRaw, err := s.getMemberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Member with PrincipalID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Member with PrincipalID %d, error: %w", id, err)
}
if memberRaw == nil {
return nil, nil
}
member, err := s.composeMember(ctx, memberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)
+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error: %w", memberRaw, err)
}
return member, nil
}
@@ -101,14 +101,14 @@ func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error)
find := &api.MemberFind{ID: &id}
memberRaw, err := s.getMemberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Member with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Member with ID %d, error: %w", id, err)
}
if memberRaw == nil {
return nil, nil
}
member, err := s.composeMember(ctx, memberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)
+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error: %w", memberRaw, err)
}
return member, nil
}
@@ -117,11 +117,11 @@ func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error)
func (s *Store) PatchMember(ctx context.Context, patch *api.MemberPatch) (*api.Member, error) {
memberRaw, err := s.patchMemberRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Member with MemberPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Member with MemberPatch[%+v], error: %w", patch, err)
}
member, err := s.composeMember(ctx, memberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)
+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error: %w", memberRaw, err)
}
return member, nil
}
diff --git a/store/pipeline.go b/store/pipeline.go
index b2f8e8334f..34a7686633 100644
--- a/store/pipeline.go
+++ b/store/pipeline.go
@@ -50,11 +50,11 @@ func (raw *pipelineRaw) toPipeline() *api.Pipeline {
func (s *Store) CreatePipeline(ctx context.Context, create *api.PipelineCreate) (*api.Pipeline, error) {
pipelineRaw, err := s.createPipelineRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Pipeline with PipelineCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Pipeline with PipelineCreate[%+v], error: %w", create, err)
}
pipeline, err := s.composePipeline(ctx, pipelineRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error[%w]", pipelineRaw, err)
+ return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error: %w", pipelineRaw, err)
}
return pipeline, nil
}
@@ -64,14 +64,14 @@ func (s *Store) GetPipelineByID(ctx context.Context, id int) (*api.Pipeline, err
find := &api.PipelineFind{ID: &id}
pipelineRaw, err := s.getPipelineRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Pipeline with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Pipeline with ID %d, error: %w", id, err)
}
if pipelineRaw == nil {
return nil, nil
}
pipeline, err := s.composePipeline(ctx, pipelineRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error[%w]", pipelineRaw, err)
+ return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error: %w", pipelineRaw, err)
}
return pipeline, nil
}
@@ -80,14 +80,14 @@ func (s *Store) GetPipelineByID(ctx context.Context, id int) (*api.Pipeline, err
func (s *Store) FindPipeline(ctx context.Context, find *api.PipelineFind, returnOnErr bool) ([]*api.Pipeline, error) {
pipelineRawList, err := s.findPipelineRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Pipeline list with PipelineFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Pipeline list with PipelineFind[%+v], error: %w", find, err)
}
var pipelineList []*api.Pipeline
for _, raw := range pipelineRawList {
pipeline, err := s.composePipeline(ctx, raw)
if err != nil {
if returnOnErr {
- return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error: %w", raw, err)
}
log.Error("failed to compose pipeline",
zap.Any("pipelineRaw", raw),
@@ -104,11 +104,11 @@ func (s *Store) FindPipeline(ctx context.Context, find *api.PipelineFind, return
func (s *Store) PatchPipeline(ctx context.Context, patch *api.PipelinePatch) (*api.Pipeline, error) {
pipelineRaw, err := s.patchPipelineRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Pipeline with PipelinePatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Pipeline with PipelinePatch[%+v], error: %w", patch, err)
}
pipeline, err := s.composePipeline(ctx, pipelineRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error[%w]", pipelineRaw, err)
+ return nil, fmt.Errorf("failed to compose Pipeline with pipelineRaw[%+v], error: %w", pipelineRaw, err)
}
return pipeline, nil
}
diff --git a/store/policy.go b/store/policy.go
index 84ebbdd053..8938af19c6 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -57,11 +57,11 @@ func (raw *policyRaw) toPolicy() *api.Policy {
func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*api.Policy, error) {
policyRaw, err := s.upsertPolicyRaw(ctx, upsert)
if err != nil {
- return nil, fmt.Errorf("failed to upsert policy with PolicyUpsert[%+v], error[%w]", upsert, err)
+ return nil, fmt.Errorf("failed to upsert policy with PolicyUpsert[%+v], error: %w", upsert, err)
}
policy, err := s.composePolicy(ctx, policyRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)
+ return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error: %w", policyRaw, err)
}
return policy, nil
}
@@ -70,11 +70,11 @@ func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*ap
func (s *Store) GetPolicy(ctx context.Context, find *api.PolicyFind) (*api.Policy, error) {
policyRaw, err := s.getPolicyRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get policy with PolicyFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get policy with PolicyFind[%+v], error: %w", find, err)
}
policy, err := s.composePolicy(ctx, policyRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)
+ return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error: %w", policyRaw, err)
}
return policy, nil
}
@@ -99,7 +99,7 @@ func (s *Store) DeletePolicy(ctx context.Context, delete *api.PolicyDelete) erro
}
policyRawList, err := findPolicyImpl(ctx, tx.PTx, find)
if err != nil {
- return fmt.Errorf("failed to list policy with PolicyFind[%+v], error[%w]", find, err)
+ return fmt.Errorf("failed to list policy with PolicyFind[%+v], error: %w", find, err)
}
if len(policyRawList) != 1 {
return &common.Error{Code: common.NotFound, Err: fmt.Errorf("failed to found policy with filter %+v, expect 1. ", find)}
@@ -136,14 +136,14 @@ func (s *Store) ListPolicy(ctx context.Context, find *api.PolicyFind) ([]*api.Po
policyRawList, err := findPolicyImpl(ctx, tx.PTx, find)
if err != nil {
- return nil, fmt.Errorf("failed to list policy with PolicyFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to list policy with PolicyFind[%+v], error: %w", find, err)
}
policyList := []*api.Policy{}
for _, raw := range policyRawList {
policy, err := s.composePolicy(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error: %w", raw, err)
}
policyList = append(policyList, policy)
}
diff --git a/store/principal.go b/store/principal.go
index 313640b9b7..a8c6b2cc46 100644
--- a/store/principal.go
+++ b/store/principal.go
@@ -56,7 +56,7 @@ func (raw *principalRaw) toPrincipal() *api.Principal {
func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreate) (*api.Principal, error) {
principalRaw, err := s.createPrincipalRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Principal with PrincipalCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Principal with PrincipalCreate[%+v], error: %w", create, err)
}
// NOTE: Currently the corresponding Member object is not created yet.
// YES, we are returning a Principal with empty Role field. OMG.
@@ -68,13 +68,13 @@ func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreate
func (s *Store) GetPrincipalList(ctx context.Context) ([]*api.Principal, error) {
principalRawList, err := s.findPrincipalRawList(ctx)
if err != nil {
- return nil, fmt.Errorf("failed to find Principal list, error[%w]", err)
+ return nil, fmt.Errorf("failed to find Principal list, error: %w", err)
}
var principalList []*api.Principal
for _, raw := range principalRawList {
principal, err := s.composePrincipal(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error: %w", raw, err)
}
principalList = append(principalList, principal)
}
@@ -86,14 +86,14 @@ func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*api.Pri
find := &api.PrincipalFind{Email: &email}
principalRaw, err := s.getPrincipalRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Principal with PrincipalFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Principal with PrincipalFind[%+v], error: %w", find, err)
}
if principalRaw == nil {
return nil, nil
}
principal, err := s.composePrincipal(ctx, principalRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)
+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error: %w", principalRaw, err)
}
return principal, nil
}
@@ -102,11 +102,11 @@ func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*api.Pri
func (s *Store) PatchPrincipal(ctx context.Context, patch *api.PrincipalPatch) (*api.Principal, error) {
principalRaw, err := s.patchPrincipalRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Principal with PrincipalPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Principal with PrincipalPatch[%+v], error: %w", patch, err)
}
principal, err := s.composePrincipal(ctx, principalRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)
+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error: %w", principalRaw, err)
}
return principal, nil
}
@@ -124,7 +124,7 @@ func (s *Store) GetPrincipalByID(ctx context.Context, id int) (*api.Principal, e
principal, err := s.composePrincipal(ctx, principalRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)
+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error: %w", principalRaw, err)
}
return principal, nil
@@ -260,7 +260,7 @@ func (s *Store) composePrincipal(ctx context.Context, raw *principalRaw) (*api.P
zap.Int("id", principal.ID),
zap.String("name", principal.Name),
)
- return nil, fmt.Errorf("member with PrincipalID[%d] not exist, error[%w]", principal.ID, err)
+ return nil, fmt.Errorf("member with PrincipalID %d not exist, error: %w", principal.ID, err)
}
principal.Role = memberRaw.Role
}
diff --git a/store/project.go b/store/project.go
index f09ba5c3fa..791bffac2e 100644
--- a/store/project.go
+++ b/store/project.go
@@ -60,14 +60,14 @@ func (s *Store) GetProjectByID(ctx context.Context, id int) (*api.Project, error
find := &api.ProjectFind{ID: &id}
projectRaw, err := s.getProjectRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Project with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Project with ID %d, error: %w", id, err)
}
if projectRaw == nil {
return nil, nil
}
project, err := s.composeProject(ctx, projectRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error[%w]", projectRaw, err)
+ return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error: %w", projectRaw, err)
}
return project, nil
}
@@ -76,13 +76,13 @@ func (s *Store) GetProjectByID(ctx context.Context, id int) (*api.Project, error
func (s *Store) FindProject(ctx context.Context, find *api.ProjectFind) ([]*api.Project, error) {
projectRawList, err := s.findProjectRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Project list with ProjectFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Project list with ProjectFind[%+v], error: %w", find, err)
}
var projectList []*api.Project
for _, raw := range projectRawList {
project, err := s.composeProject(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error: %w", raw, err)
}
projectList = append(projectList, project)
}
@@ -93,11 +93,11 @@ func (s *Store) FindProject(ctx context.Context, find *api.ProjectFind) ([]*api.
func (s *Store) CreateProject(ctx context.Context, create *api.ProjectCreate) (*api.Project, error) {
projectRaw, err := s.createProjectRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Project with ProjectCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Project with ProjectCreate[%+v], error: %w", create, err)
}
project, err := s.composeProject(ctx, projectRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error[%w]", projectRaw, err)
+ return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error: %w", projectRaw, err)
}
return project, nil
}
@@ -106,11 +106,11 @@ func (s *Store) CreateProject(ctx context.Context, create *api.ProjectCreate) (*
func (s *Store) PatchProject(ctx context.Context, patch *api.ProjectPatch) (*api.Project, error) {
projectRaw, err := s.patchProjectRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Project with ProjectPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Project with ProjectPatch[%+v], error: %w", patch, err)
}
project, err := s.composeProject(ctx, projectRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error[%w]", projectRaw, err)
+ return nil, fmt.Errorf("failed to compose Project with projectRaw[%+v], error: %w", projectRaw, err)
}
return project, nil
}
diff --git a/store/project_member.go b/store/project_member.go
index 2c1ab1165f..90c5f033bd 100644
--- a/store/project_member.go
+++ b/store/project_member.go
@@ -58,11 +58,11 @@ func (raw *projectMemberRaw) toProjectMember() *api.ProjectMember {
func (s *Store) CreateProjectMember(ctx context.Context, create *api.ProjectMemberCreate) (*api.ProjectMember, error) {
projectMemberRaw, err := s.createProjectMemberRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create ProjectMember with ProjectMemberCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create ProjectMember with ProjectMemberCreate[%+v], error: %w", create, err)
}
projectMember, err := s.composeProjectMember(ctx, projectMemberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error[%w]", projectMemberRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error: %w", projectMemberRaw, err)
}
return projectMember, nil
}
@@ -71,13 +71,13 @@ func (s *Store) CreateProjectMember(ctx context.Context, create *api.ProjectMemb
func (s *Store) FindProjectMember(ctx context.Context, find *api.ProjectMemberFind) ([]*api.ProjectMember, error) {
projectMemberRawList, err := s.findProjectMemberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find ProjectMember list with ProjectMemberFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find ProjectMember list with ProjectMemberFind[%+v], error: %w", find, err)
}
var projectMemberList []*api.ProjectMember
for _, raw := range projectMemberRawList {
projectMember, err := s.composeProjectMember(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error: %w", raw, err)
}
projectMemberList = append(projectMemberList, projectMember)
}
@@ -89,14 +89,14 @@ func (s *Store) GetProjectMemberByID(ctx context.Context, id int) (*api.ProjectM
find := &api.ProjectMemberFind{ID: &id}
projectMemberRaw, err := s.getProjectMemberRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get ProjectMember with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get ProjectMember with ID %d, error: %w", id, err)
}
if projectMemberRaw == nil {
return nil, nil
}
projectMember, err := s.composeProjectMember(ctx, projectMemberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error[%w]", projectMemberRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error: %w", projectMemberRaw, err)
}
return projectMember, nil
}
@@ -105,11 +105,11 @@ func (s *Store) GetProjectMemberByID(ctx context.Context, id int) (*api.ProjectM
func (s *Store) PatchProjectMember(ctx context.Context, patch *api.ProjectMemberPatch) (*api.ProjectMember, error) {
projectMemberRaw, err := s.patchProjectMemberRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch ProjectMember with ProjectMemberPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch ProjectMember with ProjectMemberPatch[%+v], error: %w", patch, err)
}
projectMember, err := s.composeProjectMember(ctx, projectMemberRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error[%w]", projectMemberRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectMember with projectMemberRaw[%+v], error: %w", projectMemberRaw, err)
}
return projectMember, nil
}
@@ -137,20 +137,20 @@ func (s *Store) DeleteProjectMember(ctx context.Context, delete *api.ProjectMemb
func (s *Store) BatchUpdateProjectMember(ctx context.Context, batchUpdate *api.ProjectMemberBatchUpdate) ([]*api.ProjectMember, []*api.ProjectMember, error) {
createdMemberRawList, deletedMemberRawList, err := s.batchUpdateProjectMemberRaw(ctx, batchUpdate)
if err != nil {
- return nil, nil, fmt.Errorf("failed to batch update projectMemberRaw with ProjectMemberBatchUpdate[%+v], error[%w]", batchUpdate, err)
+ return nil, nil, fmt.Errorf("failed to batch update projectMemberRaw with ProjectMemberBatchUpdate[%+v], error: %w", batchUpdate, err)
}
var createdMemberList, deletedMemberList []*api.ProjectMember
for _, raw := range createdMemberRawList {
createdMember, err := s.composeProjectMember(ctx, raw)
if err != nil {
- return nil, nil, fmt.Errorf("failed to compose created ProjectMember with projectMemberRaw[%+v], error[%w]", raw, err)
+ return nil, nil, fmt.Errorf("failed to compose created ProjectMember with projectMemberRaw[%+v], error: %w", raw, err)
}
createdMemberList = append(createdMemberList, createdMember)
}
for _, raw := range deletedMemberRawList {
deletedMember, err := s.composeProjectMember(ctx, raw)
if err != nil {
- return nil, nil, fmt.Errorf("failed to compose deleted ProjectMember with projectMemberRaw[%+v], error[%w]", raw, err)
+ return nil, nil, fmt.Errorf("failed to compose deleted ProjectMember with projectMemberRaw[%+v], error: %w", raw, err)
}
deletedMemberList = append(deletedMemberList, deletedMember)
}
diff --git a/store/project_webhook.go b/store/project_webhook.go
index bd7fb5fbb7..3833cf983e 100644
--- a/store/project_webhook.go
+++ b/store/project_webhook.go
@@ -61,11 +61,11 @@ func (raw *projectWebhookRaw) toProjectWebhook() *api.ProjectWebhook {
func (s *Store) CreateProjectWebhook(ctx context.Context, create *api.ProjectWebhookCreate) (*api.ProjectWebhook, error) {
projectWebhookRaw, err := s.createProjectWebhookRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create ProjectWebhook with ProjectWebhookCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create ProjectWebhook with ProjectWebhookCreate[%+v], error: %w", create, err)
}
projectWebhook, err := s.composeProjectWebhook(ctx, projectWebhookRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error[%w]", projectWebhookRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error: %w", projectWebhookRaw, err)
}
return projectWebhook, nil
}
@@ -75,14 +75,14 @@ func (s *Store) GetProjectWebhookByID(ctx context.Context, id int) (*api.Project
find := &api.ProjectWebhookFind{ID: &id}
projectWebhookRaw, err := s.getProjectWebhookRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get ProjectWebhook with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get ProjectWebhook with ID %d, error: %w", id, err)
}
if projectWebhookRaw == nil {
return nil, nil
}
projectWebhook, err := s.composeProjectWebhook(ctx, projectWebhookRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error[%w]", projectWebhookRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error: %w", projectWebhookRaw, err)
}
return projectWebhook, nil
}
@@ -91,13 +91,13 @@ func (s *Store) GetProjectWebhookByID(ctx context.Context, id int) (*api.Project
func (s *Store) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhookFind) ([]*api.ProjectWebhook, error) {
projectWebhookRawList, err := s.findProjectWebhookRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find ProjectWebhook list with ProjectWebhookFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find ProjectWebhook list with ProjectWebhookFind[%+v], error: %w", find, err)
}
var projectWebhookList []*api.ProjectWebhook
for _, raw := range projectWebhookRawList {
projectWebhook, err := s.composeProjectWebhook(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error: %w", raw, err)
}
projectWebhookList = append(projectWebhookList, projectWebhook)
}
@@ -108,11 +108,11 @@ func (s *Store) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhook
func (s *Store) PatchProjectWebhook(ctx context.Context, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error) {
projectWebhookRaw, err := s.patchProjectWebhookRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch ProjectWebhook with ProjectWebhookPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch ProjectWebhook with ProjectWebhookPatch[%+v], error: %w", patch, err)
}
projectWebhook, err := s.composeProjectWebhook(ctx, projectWebhookRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error[%w]", projectWebhookRaw, err)
+ return nil, fmt.Errorf("failed to compose ProjectWebhook with projectWebhookRaw[%+v], error: %w", projectWebhookRaw, err)
}
return projectWebhook, nil
}
diff --git a/store/repository.go b/store/repository.go
index 9ec0a9a3df..fdb4750930 100644
--- a/store/repository.go
+++ b/store/repository.go
@@ -81,11 +81,11 @@ func (raw *repositoryRaw) toRepository() *api.Repository {
func (s *Store) CreateRepository(ctx context.Context, create *api.RepositoryCreate) (*api.Repository, error) {
repositoryRaw, err := s.createRepositoryRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Repository with RepositoryCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Repository with RepositoryCreate[%+v], error: %w", create, err)
}
repository, err := s.composeRepository(ctx, repositoryRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error[%w]", repositoryRaw, err)
+ return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error: %w", repositoryRaw, err)
}
return repository, nil
}
@@ -94,14 +94,14 @@ func (s *Store) CreateRepository(ctx context.Context, create *api.RepositoryCrea
func (s *Store) GetRepository(ctx context.Context, find *api.RepositoryFind) (*api.Repository, error) {
repositoryRaw, err := s.getRepositoryRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Repository with RepositoryFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get Repository with RepositoryFind[%+v], error: %w", find, err)
}
if repositoryRaw == nil {
return nil, nil
}
repository, err := s.composeRepository(ctx, repositoryRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error[%w]", repositoryRaw, err)
+ return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error: %w", repositoryRaw, err)
}
return repository, nil
}
@@ -110,13 +110,13 @@ func (s *Store) GetRepository(ctx context.Context, find *api.RepositoryFind) (*a
func (s *Store) FindRepository(ctx context.Context, find *api.RepositoryFind) ([]*api.Repository, error) {
repositoryRawList, err := s.findRepositoryRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Repository list with RepositoryFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Repository list with RepositoryFind[%+v], error: %w", find, err)
}
var repositoryList []*api.Repository
for _, raw := range repositoryRawList {
repository, err := s.composeRepository(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error: %w", raw, err)
}
repositoryList = append(repositoryList, repository)
}
@@ -127,11 +127,11 @@ func (s *Store) FindRepository(ctx context.Context, find *api.RepositoryFind) ([
func (s *Store) PatchRepository(ctx context.Context, patch *api.RepositoryPatch) (*api.Repository, error) {
repositoryRaw, err := s.patchRepositoryRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Repository with RepositoryPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Repository with RepositoryPatch[%+v], error: %w", patch, err)
}
repository, err := s.composeRepository(ctx, repositoryRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error[%w]", repositoryRaw, err)
+ return nil, fmt.Errorf("failed to compose Repository with repositoryRaw[%+v], error: %w", repositoryRaw, err)
}
return repository, nil
}
diff --git a/store/setting.go b/store/setting.go
index fc4e8b2539..d60695d30f 100644
--- a/store/setting.go
+++ b/store/setting.go
@@ -50,11 +50,11 @@ func (raw *settingRaw) toSetting() *api.Setting {
func (s *Store) CreateSettingIfNotExist(ctx context.Context, create *api.SettingCreate) (*api.Setting, error) {
settingRaw, err := s.createSettingRawIfNotExist(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Setting with SettingCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Setting with SettingCreate[%+v], error: %w", create, err)
}
setting, err := s.composeSetting(ctx, settingRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error[%w]", settingRaw, err)
+ return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error: %w", settingRaw, err)
}
return setting, nil
}
@@ -63,13 +63,13 @@ func (s *Store) CreateSettingIfNotExist(ctx context.Context, create *api.Setting
func (s *Store) FindSetting(ctx context.Context, find *api.SettingFind) ([]*api.Setting, error) {
settingRawList, err := s.findSettingRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Setting list with SettingFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Setting list with SettingFind[%+v], error: %w", find, err)
}
var settingList []*api.Setting
for _, raw := range settingRawList {
setting, err := s.composeSetting(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error: %w", raw, err)
}
settingList = append(settingList, setting)
}
@@ -80,11 +80,11 @@ func (s *Store) FindSetting(ctx context.Context, find *api.SettingFind) ([]*api.
func (s *Store) PatchSetting(ctx context.Context, patch *api.SettingPatch) (*api.Setting, error) {
settingRaw, err := s.patchSettingRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Setting with SettingPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Setting with SettingPatch[%+v], error: %w", patch, err)
}
setting, err := s.composeSetting(ctx, settingRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error[%w]", settingRaw, err)
+ return nil, fmt.Errorf("failed to compose Setting with settingRaw[%+v], error: %w", settingRaw, err)
}
return setting, nil
}
diff --git a/store/sheet.go b/store/sheet.go
index a22e58fbc0..81bd6dad19 100644
--- a/store/sheet.go
+++ b/store/sheet.go
@@ -74,11 +74,11 @@ func (raw *sheetRaw) toSheet() *api.Sheet {
func (s *Store) CreateSheet(ctx context.Context, create *api.SheetCreate) (*api.Sheet, error) {
sheetRaw, err := s.createSheetRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Sheet with SheetCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Sheet with SheetCreate[%+v], error: %w", create, err)
}
sheet, err := s.composeSheet(ctx, sheetRaw, create.CreatorID)
if err != nil {
- return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error[%w]", sheetRaw, err)
+ return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error: %w", sheetRaw, err)
}
return sheet, nil
}
@@ -87,14 +87,14 @@ func (s *Store) CreateSheet(ctx context.Context, create *api.SheetCreate) (*api.
func (s *Store) GetSheet(ctx context.Context, find *api.SheetFind, currentPrincipalID int) (*api.Sheet, error) {
sheetRaw, err := s.getSheetRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Sheet with SheetFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get Sheet with SheetFind[%+v], error: %w", find, err)
}
if sheetRaw == nil {
return nil, nil
}
sheet, err := s.composeSheet(ctx, sheetRaw, currentPrincipalID)
if err != nil {
- return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error[%w]", sheetRaw, err)
+ return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error: %w", sheetRaw, err)
}
return sheet, nil
}
@@ -103,13 +103,13 @@ func (s *Store) GetSheet(ctx context.Context, find *api.SheetFind, currentPrinci
func (s *Store) FindSheet(ctx context.Context, find *api.SheetFind, currentPrincipalID int) ([]*api.Sheet, error) {
sheetRawList, err := s.findSheetRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Sheet list, error[%w]", err)
+ return nil, fmt.Errorf("failed to find Sheet list, error: %w", err)
}
var sheetList []*api.Sheet
for _, raw := range sheetRawList {
sheet, err := s.composeSheet(ctx, raw, currentPrincipalID)
if err != nil {
- return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error: %w", raw, err)
}
sheetList = append(sheetList, sheet)
}
@@ -120,11 +120,11 @@ func (s *Store) FindSheet(ctx context.Context, find *api.SheetFind, currentPrinc
func (s *Store) PatchSheet(ctx context.Context, patch *api.SheetPatch) (*api.Sheet, error) {
sheetRaw, err := s.patchSheetRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Sheet with SheetPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Sheet with SheetPatch[%+v], error: %w", patch, err)
}
sheet, err := s.composeSheet(ctx, sheetRaw, patch.UpdaterID)
if err != nil {
- return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error[%w]", sheetRaw, err)
+ return nil, fmt.Errorf("failed to compose Sheet with sheetRaw[%+v], error: %w", sheetRaw, err)
}
return sheet, nil
}
diff --git a/store/stage.go b/store/stage.go
index 04ad3d0951..b35a217544 100644
--- a/store/stage.go
+++ b/store/stage.go
@@ -53,11 +53,11 @@ func (raw *stageRaw) toStage() *api.Stage {
func (s *Store) CreateStage(ctx context.Context, create *api.StageCreate) (*api.Stage, error) {
stageRaw, err := s.createStageRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Stage with StageCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Stage with StageCreate[%+v], error: %w", create, err)
}
stage, err := s.composeStage(ctx, stageRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Stage with stageRaw[%+v], error[%w]", stageRaw, err)
+ return nil, fmt.Errorf("failed to compose Stage with stageRaw[%+v], error: %w", stageRaw, err)
}
return stage, nil
}
@@ -66,13 +66,13 @@ func (s *Store) CreateStage(ctx context.Context, create *api.StageCreate) (*api.
func (s *Store) FindStage(ctx context.Context, find *api.StageFind) ([]*api.Stage, error) {
stageRawList, err := s.findStageRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Stage list with StageFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Stage list with StageFind[%+v], error: %w", find, err)
}
var stageList []*api.Stage
for _, raw := range stageRawList {
stage, err := s.composeStage(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Stage with stageRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Stage with stageRaw[%+v], error: %w", raw, err)
}
stageList = append(stageList, stage)
}
diff --git a/store/table.go b/store/table.go
index 0a20cb3d20..b4839ffb3e 100644
--- a/store/table.go
+++ b/store/table.go
@@ -70,11 +70,11 @@ func (raw *tableRaw) toTable() *api.Table {
func (s *Store) CreateTable(ctx context.Context, create *api.TableCreate) (*api.Table, error) {
tableRaw, err := s.createTableRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Table with TableCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Table with TableCreate[%+v], error: %w", create, err)
}
table, err := s.composeTable(ctx, tableRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error[%w]", tableRaw, err)
+ return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error: %w", tableRaw, err)
}
return table, nil
}
@@ -83,14 +83,14 @@ func (s *Store) CreateTable(ctx context.Context, create *api.TableCreate) (*api.
func (s *Store) GetTable(ctx context.Context, find *api.TableFind) (*api.Table, error) {
tableRaw, err := s.getTableRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Table with TableFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to get Table with TableFind[%+v], error: %w", find, err)
}
if tableRaw == nil {
return nil, nil
}
table, err := s.composeTable(ctx, tableRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error[%w]", tableRaw, err)
+ return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error: %w", tableRaw, err)
}
return table, nil
}
@@ -99,13 +99,13 @@ func (s *Store) GetTable(ctx context.Context, find *api.TableFind) (*api.Table,
func (s *Store) FindTable(ctx context.Context, find *api.TableFind) ([]*api.Table, error) {
tableRawList, err := s.findTableRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Table list, error[%w]", err)
+ return nil, fmt.Errorf("failed to find Table list, error: %w", err)
}
var tableList []*api.Table
for _, raw := range tableRawList {
table, err := s.composeTable(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Table with tableRaw[%+v], error: %w", raw, err)
}
tableList = append(tableList, table)
}
diff --git a/store/task.go b/store/task.go
index 1d2786b4ed..589a7ee1db 100644
--- a/store/task.go
+++ b/store/task.go
@@ -84,11 +84,11 @@ func (raw *taskRaw) toTask() *api.Task {
func (s *Store) CreateTask(ctx context.Context, create *api.TaskCreate) (*api.Task, error) {
taskRaw, err := s.createTaskRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create Task with TaskCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create Task with TaskCreate[%+v], error: %w", create, err)
}
task, err := s.composeTask(ctx, taskRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error[%w]", taskRaw, err)
+ return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error: %w", taskRaw, err)
}
return task, nil
}
@@ -98,14 +98,14 @@ func (s *Store) GetTaskByID(ctx context.Context, id int) (*api.Task, error) {
find := &api.TaskFind{ID: &id}
taskRaw, err := s.getTaskRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to get Task with ID[%d], error[%w]", id, err)
+ return nil, fmt.Errorf("failed to get Task with ID %d, error: %w", id, err)
}
if taskRaw == nil {
return nil, nil
}
task, err := s.composeTask(ctx, taskRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error[%w]", taskRaw, err)
+ return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error: %w", taskRaw, err)
}
return task, nil
}
@@ -114,14 +114,14 @@ func (s *Store) GetTaskByID(ctx context.Context, id int) (*api.Task, error) {
func (s *Store) FindTask(ctx context.Context, find *api.TaskFind, returnOnErr bool) ([]*api.Task, error) {
taskRawList, err := s.findTaskRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find Task list with TaskFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find Task list with TaskFind[%+v], error: %w", find, err)
}
var taskList []*api.Task
for _, raw := range taskRawList {
task, err := s.composeTask(ctx, raw)
if err != nil {
if returnOnErr {
- return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error: %w", raw, err)
}
log.Error("failed to compose Task",
zap.Any("taskRaw", raw),
@@ -138,11 +138,11 @@ func (s *Store) FindTask(ctx context.Context, find *api.TaskFind, returnOnErr bo
func (s *Store) PatchTask(ctx context.Context, patch *api.TaskPatch) (*api.Task, error) {
taskRaw, err := s.patchTaskRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch Task with TaskPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch Task with TaskPatch[%+v], error: %w", patch, err)
}
task, err := s.composeTask(ctx, taskRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error[%w]", taskRaw, err)
+ return nil, fmt.Errorf("failed to compose Task with taskRaw[%+v], error: %w", taskRaw, err)
}
return task, nil
}
@@ -151,11 +151,11 @@ func (s *Store) PatchTask(ctx context.Context, patch *api.TaskPatch) (*api.Task,
func (s *Store) PatchTaskStatus(ctx context.Context, patch *api.TaskStatusPatch) (*api.Task, error) {
taskRaw, err := s.patchTaskRawStatus(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch TaskStatus with TaskStatusPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch TaskStatus with TaskStatusPatch[%+v], error: %w", patch, err)
}
task, err := s.composeTask(ctx, taskRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose TaskStatus with taskRaw[%+v], error[%w]", taskRaw, err)
+ return nil, fmt.Errorf("failed to compose TaskStatus with taskRaw[%+v], error: %w", taskRaw, err)
}
return task, nil
}
diff --git a/store/task_check_run.go b/store/task_check_run.go
index 05aac0afc5..13c4153679 100644
--- a/store/task_check_run.go
+++ b/store/task_check_run.go
@@ -64,11 +64,11 @@ func (raw *taskCheckRunRaw) toTaskCheckRun() *api.TaskCheckRun {
func (s *Store) CreateTaskCheckRunIfNeeded(ctx context.Context, create *api.TaskCheckRunCreate) (*api.TaskCheckRun, error) {
taskCheckRunRaw, err := s.createTaskCheckRunRawIfNeeded(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create TaskCheckRun with TaskCheckRunCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create TaskCheckRun with TaskCheckRunCreate[%+v], error: %w", create, err)
}
taskCheckRun, err := s.composeTaskCheckRun(ctx, taskCheckRunRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose TaskCheckRun with taskCheckRunRaw[%+v], error[%w]", taskCheckRunRaw, err)
+ return nil, fmt.Errorf("failed to compose TaskCheckRun with taskCheckRunRaw[%+v], error: %w", taskCheckRunRaw, err)
}
return taskCheckRun, nil
}
@@ -77,13 +77,13 @@ func (s *Store) CreateTaskCheckRunIfNeeded(ctx context.Context, create *api.Task
func (s *Store) FindTaskCheckRun(ctx context.Context, find *api.TaskCheckRunFind) ([]*api.TaskCheckRun, error) {
taskCheckRunRawList, err := s.findTaskCheckRunRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find TaskCheckRun list with TaskCheckRunFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find TaskCheckRun list with TaskCheckRunFind[%+v], error: %w", find, err)
}
var taskCheckRunList []*api.TaskCheckRun
for _, raw := range taskCheckRunRawList {
taskCheckRun, err := s.composeTaskCheckRun(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose TaskCheckRun with taskCheckRunRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose TaskCheckRun with taskCheckRunRaw[%+v], error: %w", raw, err)
}
taskCheckRunList = append(taskCheckRunList, taskCheckRun)
}
@@ -94,11 +94,11 @@ func (s *Store) FindTaskCheckRun(ctx context.Context, find *api.TaskCheckRunFind
func (s *Store) PatchTaskCheckRunStatus(ctx context.Context, patch *api.TaskCheckRunStatusPatch) (*api.TaskCheckRun, error) {
taskCheckRunRaw, err := s.patchTaskCheckRunRawStatus(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch TaskCheckRunStatus with TaskCheckRunStatusPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch TaskCheckRunStatus with TaskCheckRunStatusPatch[%+v], error: %w", patch, err)
}
taskCheckRun, err := s.composeTaskCheckRun(ctx, taskCheckRunRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose TaskCheckRunStatus with taskCheckRunRaw[%+v], error[%w]", taskCheckRunRaw, err)
+ return nil, fmt.Errorf("failed to compose TaskCheckRunStatus with taskCheckRunRaw[%+v], error: %w", taskCheckRunRaw, err)
}
return taskCheckRun, nil
}
diff --git a/store/task_dag.go b/store/task_dag.go
index 55fccaee45..867498941c 100644
--- a/store/task_dag.go
+++ b/store/task_dag.go
@@ -37,7 +37,7 @@ func (raw *taskDAGRaw) toTaskDAG() *api.TaskDAG {
func (s *Store) CreateTaskDAG(ctx context.Context, create *api.TaskDAGCreate) (*api.TaskDAG, error) {
taskDAGRaw, err := s.createTaskDAGRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create TaskDAG with TaskDAGCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create TaskDAG with TaskDAGCreate[%+v], error: %w", create, err)
}
taskDAG := taskDAGRaw.toTaskDAG()
return taskDAG, nil
@@ -47,7 +47,7 @@ func (s *Store) CreateTaskDAG(ctx context.Context, create *api.TaskDAGCreate) (*
func (s *Store) FindTaskDAGList(ctx context.Context, find *api.TaskDAGFind) ([]*api.TaskDAG, error) {
taskDAGRawList, err := s.findTaskDAGRawList(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find TaskDAG with TaskDAGFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find TaskDAG with TaskDAGFind[%+v], error: %w", find, err)
}
var taskDAGList []*api.TaskDAG
for _, taskDAGRaw := range taskDAGRawList {
diff --git a/store/vcs.go b/store/vcs.go
index 93f78a60ba..9758fe8101 100644
--- a/store/vcs.go
+++ b/store/vcs.go
@@ -55,11 +55,11 @@ func (raw *vcsRaw) toVCS() *api.VCS {
func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS, error) {
vcsRaw, err := s.createVCSRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create VCS with VCSCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create VCS with VCSCreate[%+v], error: %w", create, err)
}
vcs, err := s.composeVCS(ctx, vcsRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)
+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error: %w", vcsRaw, err)
}
return vcs, nil
}
@@ -68,13 +68,13 @@ func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS,
func (s *Store) FindVCS(ctx context.Context, find *api.VCSFind) ([]*api.VCS, error) {
vcsRawList, err := s.findVCSRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find VCS list with VCSFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find VCS list with VCSFind[%+v], error: %w", find, err)
}
var vcsList []*api.VCS
for _, raw := range vcsRawList {
vcs, err := s.composeVCS(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error: %w", raw, err)
}
vcsList = append(vcsList, vcs)
}
@@ -102,11 +102,11 @@ func (s *Store) GetVCSByID(ctx context.Context, id int) (*api.VCS, error) {
func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, error) {
vcsRaw, err := s.patchVCSRaw(ctx, patch)
if err != nil {
- return nil, fmt.Errorf("failed to patch VCS with VCSPatch[%+v], error[%w]", patch, err)
+ return nil, fmt.Errorf("failed to patch VCS with VCSPatch[%+v], error: %w", patch, err)
}
vcs, err := s.composeVCS(ctx, vcsRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)
+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error: %w", vcsRaw, err)
}
return vcs, nil
}
@@ -114,7 +114,7 @@ func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, er
// DeleteVCS deletes an instance of VCS
func (s *Store) DeleteVCS(ctx context.Context, delete *api.VCSDelete) error {
if err := s.deleteVCSRaw(ctx, delete); err != nil {
- return fmt.Errorf("failed to delete VCS with VCSDelete[%+v], error[%w]", delete, err)
+ return fmt.Errorf("failed to delete VCS with VCSDelete[%+v], error: %w", delete, err)
}
return nil
}
diff --git a/store/view.go b/store/view.go
index 84dabad6f9..32bb0588df 100644
--- a/store/view.go
+++ b/store/view.go
@@ -55,11 +55,11 @@ func (raw *viewRaw) toView() *api.View {
func (s *Store) CreateView(ctx context.Context, create *api.ViewCreate) (*api.View, error) {
viewRaw, err := s.createViewRaw(ctx, create)
if err != nil {
- return nil, fmt.Errorf("failed to create View with ViewCreate[%+v], error[%w]", create, err)
+ return nil, fmt.Errorf("failed to create View with ViewCreate[%+v], error: %w", create, err)
}
view, err := s.composeView(ctx, viewRaw)
if err != nil {
- return nil, fmt.Errorf("failed to compose View with viewRaw[%+v], error[%w]", viewRaw, err)
+ return nil, fmt.Errorf("failed to compose View with viewRaw[%+v], error: %w", viewRaw, err)
}
return view, nil
}
@@ -68,13 +68,13 @@ func (s *Store) CreateView(ctx context.Context, create *api.ViewCreate) (*api.Vi
func (s *Store) FindView(ctx context.Context, find *api.ViewFind) ([]*api.View, error) {
viewRawList, err := s.findViewRaw(ctx, find)
if err != nil {
- return nil, fmt.Errorf("failed to find View list with ViewFind[%+v], error[%w]", find, err)
+ return nil, fmt.Errorf("failed to find View list with ViewFind[%+v], error: %w", find, err)
}
var viewList []*api.View
for _, raw := range viewRawList {
view, err := s.composeView(ctx, raw)
if err != nil {
- return nil, fmt.Errorf("failed to compose View with viewRaw[%+v], error[%w]", raw, err)
+ return nil, fmt.Errorf("failed to compose View with viewRaw[%+v], error: %w", raw, err)
}
viewList = append(viewList, view)
}