handle error from bu.backupCollections (#2386)
## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change - [x] 🐛 Bugfix ## Test Plan - [x] 💚 E2E
This commit is contained in:
parent
76c2ac628b
commit
0be38909dd
@ -167,6 +167,12 @@ func (op *BackupOperation) do(ctx context.Context) (err error) {
|
|||||||
|
|
||||||
// persist operation results to the model store on exit
|
// persist operation results to the model store on exit
|
||||||
defer func() {
|
defer func() {
|
||||||
|
// panic recovery here prevents additional errors in op.persistResults()
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = clues.Wrap(r.(error), "panic recovery").WithClues(ctx).With("stacktrace", debug.Stack())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = op.persistResults(startTime, &opStats)
|
err = op.persistResults(startTime, &opStats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
op.Errors.Fail(errors.Wrap(err, "persisting backup results"))
|
op.Errors.Fail(errors.Wrap(err, "persisting backup results"))
|
||||||
@ -445,24 +451,22 @@ func consumeBackupDataCollections(
|
|||||||
cs,
|
cs,
|
||||||
nil,
|
nil,
|
||||||
tags,
|
tags,
|
||||||
isIncremental,
|
isIncremental)
|
||||||
)
|
if err != nil {
|
||||||
|
if kopiaStats == nil {
|
||||||
|
return nil, nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, nil, nil, errors.Wrapf(
|
||||||
|
err,
|
||||||
|
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
||||||
|
kopiaStats.ErrorCount, kopiaStats.IgnoredErrorCount)
|
||||||
|
}
|
||||||
|
|
||||||
if kopiaStats.ErrorCount > 0 || kopiaStats.IgnoredErrorCount > 0 {
|
if kopiaStats.ErrorCount > 0 || kopiaStats.IgnoredErrorCount > 0 {
|
||||||
if err != nil {
|
err = errors.Errorf(
|
||||||
err = errors.Wrapf(
|
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
||||||
err,
|
kopiaStats.ErrorCount, kopiaStats.IgnoredErrorCount)
|
||||||
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
|
||||||
kopiaStats.ErrorCount,
|
|
||||||
kopiaStats.IgnoredErrorCount,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
err = errors.Errorf(
|
|
||||||
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
|
||||||
kopiaStats.ErrorCount,
|
|
||||||
kopiaStats.IgnoredErrorCount,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return kopiaStats, deets, itemsSourcedFromBase, err
|
return kopiaStats, deets, itemsSourcedFromBase, err
|
||||||
|
|||||||
@ -151,6 +151,12 @@ func (op *RestoreOperation) do(ctx context.Context) (restoreDetails *details.Det
|
|||||||
)
|
)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
// panic recovery here prevents additional errors in op.persistResults()
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = clues.Wrap(r.(error), "panic recovery").WithClues(ctx).With("stacktrace", debug.Stack())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = op.persistResults(ctx, startTime, &opStats)
|
err = op.persistResults(ctx, startTime, &opStats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user