Skip to content

Commit c17d006

Browse files
committed
format error before writing restore metadata
1 parent 97431be commit c17d006

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmd/pbm-agent/restore.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"fmt"
56
"runtime"
67
"time"
78

@@ -238,7 +239,9 @@ func addRestoreMetaWithError(
238239
errStr string,
239240
args ...any,
240241
) error {
241-
l.Error(errStr, args...)
242+
errMsg := fmt.Sprintf(errStr, args...)
243+
244+
l.Error(errMsg)
242245

243246
meta := &restore.RestoreMeta{
244247
Type: defs.LogicalBackup,
@@ -248,7 +251,7 @@ func addRestoreMetaWithError(
248251
PITR: int64(cmd.OplogTS.T),
249252
StartTS: time.Now().UTC().Unix(),
250253
Status: defs.StatusError,
251-
Error: errStr,
254+
Error: errMsg,
252255
Replsets: []restore.RestoreReplset{},
253256
}
254257
err := restore.SetRestoreMetaIfNotExists(ctx, conn, meta)
@@ -260,7 +263,7 @@ func addRestoreMetaWithError(
260263
Name: setName,
261264
StartTS: time.Now().UTC().Unix(),
262265
Status: defs.StatusError,
263-
Error: errStr,
266+
Error: errMsg,
264267
Conditions: restore.Conditions{},
265268
}
266269
err = restore.AddRestoreRSMeta(ctx, conn, cmd.Name, rs)

0 commit comments

Comments
 (0)